@@ -331,7 +331,9 @@ def make_document_landmark_detections(
331331 MODEL_CONFIG ["intraoperative_document_landmarks" ]["vert_overlap_proportion" ],
332332 )
333333 detections = non_maximum_suppression (
334- detections , overlap_comparator = intersection_over_minimum
334+ detections ,
335+ overlap_comparator = intersection_over_minimum ,
336+ sorting_fn = lambda det : det .annotation .area * det .confidence ,
335337 )
336338 del document_model
337339 return detections
@@ -479,13 +481,22 @@ def tile_predict(
479481 )
480482
481483 sys_dets : List [Detection ] = non_maximum_suppression (
482- sys_dets , 0.5 , intersection_over_minimum
484+ sys_dets ,
485+ 0.5 ,
486+ intersection_over_minimum ,
487+ lambda det : det .annotation .area * det .confidence ,
483488 )
484489 dia_dets : List [Detection ] = non_maximum_suppression (
485- dia_dets , 0.5 , intersection_over_minimum
490+ dia_dets ,
491+ 0.5 ,
492+ intersection_over_minimum ,
493+ lambda det : det .annotation .area * det .confidence ,
486494 )
487495 hr_dets : List [Detection ] = non_maximum_suppression (
488- hr_dets , 0.5 , intersection_over_minimum
496+ hr_dets ,
497+ 0.5 ,
498+ intersection_over_minimum ,
499+ lambda det : det .annotation .area * det .confidence ,
489500 )
490501
491502 dets : List [Detection ] = sys_dets + dia_dets + hr_dets
0 commit comments