Calculate the Intersection over Union score for object detection bounding boxes.
Intersection over Union (IoU) measures how well a predicted bounding box overlaps with the ground truth. It equals the area of overlap divided by the total area covered by both boxes. An IoU ≥ 0.5 is typically considered a 'correct' detection in object detection benchmarks.
IoU
IoU = Intersection / Union = Intersection / (Area_A + Area_B - Intersection)
PASCAL VOC uses 0.5, while COCO uses multiple thresholds (0.5 to 0.95 in steps of 0.05) for a more comprehensive evaluation called AP@[.5:.95].
Yes — for semantic/instance segmentation, IoU is computed over pixel-level masks rather than bounding boxes, and is also called the Jaccard index in that context.