All problems
mAP at IoU Threshold
Problem
Compute average precision for one class at a single IoU threshold.
Sort detections by descending score (ties by index) and match each to its highest-IoU ground-truth box; it is a true positive only when that IoU is at least iou_threshold and the ground truth is still unmatched. detections is a list of [box, score]. AP is the sum of precision at each true positive divided by the number of ground truths, rounded to 4 decimal places; return 0.0 with no ground truths.
Test cases
case 1
in: [[[[0,0,2,2],0.95],[[10,10,12,12],0.9],[[1,1,3,3],0.8]],[[0,0,2,2],[10,10,12,12]],0.5]
expected: 1
case 2
in: [[[[0,0,2,2],0.9],[[0,0,2,2],0.8]],[[0,0,2,2]],0.5]
expected: 1
case 3
in: [[[[0,0,2,2],0.9]],[],0.5]
expected: 0
case 4
in: [[],[[0,0,2,2]],0.5]
expected: 0
Starter codePython
def map_at_iou(detections, gt_boxes, iou_threshold):
# Your code here
pass4 test cases · run your code against them in the editor