dice_multiclass
Compute multi-class dice 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 = 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 dice-metrics. Shape: (num_classes,).