Skip to content

average_precision

average_precision

average_precision(
    true: ndarray,
    pred: ndarray,
    thresh: float = 0.5,
    eps: float = 1e-08,
) -> float

Compute the average precision of a labelled mask.

Parameters

true : np.ndarray
    Ground truth (labelled mask). Shape (H, W).
pred : np.ndarray
    Predicted (labelled mask). Shape (H, W).
thresh : float, default=0.5
    Threshold for the iou to include the prediction as TP
eps : float, default=1e-8:
    Epsilon to avoid zero div errors.

Returns

float:
    The computed precision.