@@ -331,14 +331,17 @@ def evaluate_detection_batch(
331
331
det_class = detection_classes [det_idx ]
332
332
class_match = (gt_class == det_class )
333
333
valid_matches .append ((gt_idx , det_idx , iou , class_match ))
334
- # print(f"Valid match: GT[{gt_idx}] class={gt_class} vs Det[{det_idx}] class={det_class}, IoU={iou:.3f}, class_match={class_match}")
334
+ # print(f"Valid match: GT[{gt_idx}] class={gt_class} vs
335
+ # Det[{det_idx}] class={det_class}, IoU={iou:.3f},
336
+ # class_match={class_match}")
335
337
336
338
# Sort matches by class match first (True before False), then by IoU descending
337
339
# This prioritizes correct class predictions over higher IoU with wrong class
338
340
valid_matches .sort (key = lambda x : (x [3 ], x [2 ]), reverse = True )
339
341
# print(f"Sorted matches: {valid_matches}")
340
342
341
- # Greedily assign matches, ensuring each GT and detection is matched at most once
343
+ # Greedily assign matches, ensuring each GT
344
+ # and detection is matched at most once
342
345
matched_gt_idx = set ()
343
346
matched_det_idx = set ()
344
347
@@ -347,7 +350,8 @@ def evaluate_detection_batch(
347
350
# Valid spatial match - record the class prediction
348
351
gt_class = true_classes [gt_idx ]
349
352
det_class = detection_classes [det_idx ]
350
- # print(f"Assigning match: GT[{gt_idx}] class={gt_class} -> Det[{det_idx}] class={det_class}")
353
+ # print(f"Assigning match: GT[{gt_idx}] class={gt_class} ->
354
+ # Det[{det_idx}] class={det_class}")
351
355
# This handles both correct classification (TP) and misclassification
352
356
result_matrix [gt_class , det_class ] += 1
353
357
matched_gt_idx .add (gt_idx )
0 commit comments