What is Intersection Over Union (IoU)?
The intersection over union (IoU) is a score that measures the overlap of two regions as shared area divided by combined area. The two regions are usually a predicted mask or box and a ground truth mask or box.
Calculation
IoU = |A ∩ B| / |A ∪ B|
A is the predicted region and B is the ground truth region. The intersection is the area that is in both. The union is the area that is in at least one of them. The value is 0 when the regions do not overlap and 1 when they are equal. The same score is the Jaccard index.
For a pixel mask, IoU can also be written as TP / (TP + FP + FN). TP is the number of pixels in both masks. FP is the number of pixels only in the prediction. FN is the number of pixels only in the ground truth.

Use in benchmarks
The PASCAL VOC detection task counts a predicted box as correct when its IoU with the ground truth box is above 0.5. The VOC authors set this threshold low on purpose, because the ground truth boxes are not exact. From VOC2008, the VOC segmentation task also scores each class with TP / (TP + FP + FN).
The COCO evaluation code reports average precision at IoU 0.50, at IoU 0.75, and averaged over ten thresholds from 0.50 to 0.95.
Mean IoU
Mean IoU (mIoU) is the IoU of each class, averaged over all classes.
IoU and the Dice coefficient
The Dice coefficient (Sørensen-Dice) measures the same overlap on a different scale. With Dice written as S and IoU as J:
- S = 2J / (1 + J)
- J = S / (2 - S)
For the same pair of masks, Dice is equal to or higher than IoU. A segmentation with TP = 80, FP = 20 and FN = 20 has an IoU of 0.67 and a Dice of 0.80. Compare scores only when they use the same metric.
Use in pavement crack segmentation
Published pavement crack segmentation models, for example Context-CrackNet, report mIoU together with the Dice score. An IoU value compares a model mask with a reference mask. It does not give the width, the length or the severity of a crack.
Frequently Asked Questions
- How is IoU calculated?
- IoU is the area of the intersection of two regions divided by the area of their union. For pixel masks it equals TP / (TP + FP + FN). TP is the pixels in both masks. FP is the pixels only in the prediction. FN is the pixels only in the ground truth. The result is between 0 and 1.
- What is the difference between IoU and the Dice coefficient?
- Both measure overlap and one can be converted into the other. Dice = 2 x IoU / (1 + IoU), and IoU = Dice / (2 - Dice). Dice is therefore equal to or higher than IoU for the same pair of masks. An IoU of 0.5 is a Dice of about 0.67.
- What IoU threshold counts as a correct detection?
- It depends on the benchmark. The PASCAL VOC detection task requires an overlap ratio above 0.5. The COCO evaluation reports average precision at IoU 0.50, at IoU 0.75, and averaged over ten thresholds from 0.50 to 0.95 in steps of 0.05.
References
- wikipedia-jaccard
- Jaccard index Wikipedia
- pascal-voc-2010
- The PASCAL Visual Object Classes (VOC) Challenge, International Journal of Computer Vision 88, 303-338 (2010) Everingham, Van Gool, Williams, Winn, Zisserman
- coco-cocoeval
- pycocotools cocoeval.py (COCO API) COCO Consortium
- context-cracknet
- Context-CrackNet: A Context-Aware Framework for Precise Segmentation of Tiny Cracks in Pavement images (arXiv 2501.14413) Kyem, Asamoah, Aboah
This is a reference entry. TarmacView provides drone inspection services and doesn't sell the equipment or materials described in this glossary.