SegmentationBinaryAveragePrecision#

class torch_uncertainty.metrics.segmentation.SegmentationBinaryAveragePrecision(thresholds=None, ignore_index=None, validate_args=True, **kwargs)[source]#

Image-averaged binary Average Precision for dense segmentation tasks.

Per-image Average Precision summarises the precision-recall curve obtained by sweeping a threshold over the pixel scores of image \(b\):

\[\text{AP}_b = \sum_{k} \left( R_b(k) - R_b(k-1) \right) P_b(k),\]

where \(P_b(k)\) and \(R_b(k)\) are the precision and recall at the \(k\)-th threshold. The final metric is averaged over all \(B\) images:

\[\text{AP} = \frac{1}{B} \sum_{b=1}^{B} \text{AP}_b.\]

As for SegmentationBinaryAUROC, image-wise averaging is the convention used in the dense OOD-detection literature.

Parameters:
  • thresholds (int | list[float] | Tensor | None) – Optional explicit thresholds for the PR curve, see BinaryAveragePrecision.

  • ignore_index (int | None) – Optional label value to ignore.

  • validate_args (bool) – Whether to validate input arguments.

  • kwargs (Any) – Additional keyword arguments, see Advanced metric settings.