Skip to content

f1score_multiclass

Compute multi-class f1-score 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 f1score-metrics. Shape: (num_classes,).