Skip to content

Commit 8d2354a

Browse files
Fixed long lines in file
1 parent 65411ae commit 8d2354a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

supervision/metrics/detection.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,17 @@ def evaluate_detection_batch(
331331
det_class = detection_classes[det_idx]
332332
class_match = (gt_class == det_class)
333333
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}")
335337

336338
# Sort matches by class match first (True before False), then by IoU descending
337339
# This prioritizes correct class predictions over higher IoU with wrong class
338340
valid_matches.sort(key=lambda x: (x[3], x[2]), reverse=True)
339341
# print(f"Sorted matches: {valid_matches}")
340342

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
342345
matched_gt_idx = set()
343346
matched_det_idx = set()
344347

@@ -347,7 +350,8 @@ def evaluate_detection_batch(
347350
# Valid spatial match - record the class prediction
348351
gt_class = true_classes[gt_idx]
349352
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}")
351355
# This handles both correct classification (TP) and misclassification
352356
result_matrix[gt_class, det_class] += 1
353357
matched_gt_idx.add(gt_idx)

0 commit comments

Comments
 (0)