Intersection over Union

Visualizing Intersection over Union

Intersection over Union (also known as Jaccard index or IoU) is a measure of similarity between two sets. It is useful in computer vision applications such as segmentation and object detection to determine the similarity between predictions and labels.

Mathematically it is written as:

$$ IoU = \frac{|A \cap B|}{|A| \cup |B|} $$

For the case of binary classification, it can be written as: $$ IoU = \frac{TP}{TP+FN+FP} $$

Below is what Intersection over Union visually looks like. You can move and resize the two rectangles to get an intuitive feeling of the value of the score.