IoU, also called the Jaccard index, compares two regions by how much they share relative to how much they cover together. In object detection, a predicted box counts as a true positive only if its IoU with a ground-truth box clears a threshold: 0.5 in PASCAL VOC, while COCO averages precision over thresholds from 0.5 to 0.95.
Example: the ground-truth box spans (0, 0) to (10, 10) and the prediction (5, 0) to (15, 10). The intersection is 5 × 10 = 50 and the union is 100 + 100 − 50 = 150, so IoU = 0.33. The prediction covers half the object yet fails the usual 0.5 threshold, which shows how strict IoU is about position.
For segmentation, the Dice coefficient, 2|A ∩ B| / (|A| + |B|), is common; it equals 2·IoU / (1 + IoU), so the two rank predictions the same way. Both are used as losses in soft, differentiable forms. Plain IoU loss has zero gradient when boxes don't overlap, which Generalized IoU (Rezatofighi et al., 2019) fixes by also penalizing the empty space in the smallest box enclosing both.