Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions perceptionmetrics/utils/detection_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,13 @@ def _match_predictions(

ious = compute_iou_matrix(pred_boxes, gt_boxes) # shape: (num_preds, num_gts)

for i, (p_box, p_label, score) in enumerate(
zip(pred_boxes, pred_labels, pred_scores)
):
# Sort predictions by descending score to ensure highest-confidence predictions match first
sorted_indices = np.argsort([-s for s in pred_scores])

for i in sorted_indices:
p_box = pred_boxes[i]
p_label = pred_labels[i]
score = pred_scores[i]
max_iou = 0
max_j = -1

Expand Down