Skip to content
EvalSuite
Documentation menu

Segmentation

Intersection over union

Implementedsegmentation.iou

Definition

Ratio of the intersection to the union of predicted and ground-truth masks (Jaccard index).

Formula

IoU = |A ∩ B| / |A ∪ B|

Range: [0, 1]

Inputs and outputs

  • y_true: ground-truth mask (H×W or N×H×W)
  • y_pred: predicted mask with the same shape

Returns: float or per-class array

Assumptions

No assumptions beyond valid, aligned inputs of the documented types.

Limitations

No metric-specific limitations are documented yet. Interpret the value alongside the task, data, and other metrics.

Python API

PythonSince v0.3.0
import evalsuite as es

es.iou(y_true, y_pred, average=None)  # per class; absent classes are NaN

References

  1. Jaccard, P. (1912). The distribution of the flora in the alpine zone. New Phytologist, 11(2), 37–50.

Implementation status