SegmentationBinaryAUROC#

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

Image-averaged binary AUROC for dense binary segmentation tasks.

At each image, a per-pixel binary AUROC is computed from the pixel scores \(s_{ij}\) and binary labels \(y_{ij} \in \{0, 1\}\):

\[\text{AUROC}_b = \int_0^1 \text{TPR}_b\!\left(\text{FPR}_b^{-1}(u)\right) \mathrm{d}u,\]

where TPR and FPR are computed by sweeping a threshold over the pixel-level scores of image \(b\). The final metric is the average over all images:

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

This image-wise averaging is the convention used in the dense OOD-detection literature (e.g., MUAD) and behaves better than computing AUROC over the flattened set of all pixels when image sizes or OOD prevalences vary.

Images without both positive and negative pixels are excluded because their AUROC is undefined. The metric returns nan if no valid image was observed. A one-dimensional input is treated as one image; otherwise, the first dimension is the image batch dimension.

Parameters:
  • max_fpr (float | None) – If set, computes the partial AUROC up to this FPR value (passed to BinaryAUROC).

  • thresholds (int | list[float] | Tensor | None) – Optional explicit thresholds to use when computing the ROC.

  • 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.