iou_multiclass
iou_multiclass ¶
iou_multiclass(
true: ndarray,
pred: ndarray,
num_classes: int,
eps: float = 1e-08,
clamp_absent: bool = True,
) -> np.ndarray
Compute multi-class intersection over union for semantic segmentation masks.
Parameters¶
true : np.ndarray
Ground truth semantic mask. Shape (H, W).
pred : np.ndarray
Predicted semantic mask. Shape (H, W).
num_classes : int
Number of classes in the training dataset.
eps : float, default=1e-8:
Epsilon to avoid zero div errors.
clamp_absent : bool, default=True
If a class is not present in either true or pred, the value of that ix
in the result array will be clamped to -1.0.
Returns¶
np.ndarray:
Per class IoU-metrics. Shape: (num_classes,).