Better than Average: Spatially-Aware Aggregation of Segmentation Uncertainty Improves Downstream Performance
Authors: Vanessa Emanuela Guarino, Claudia Winklmayr, Jannik Franzen, Josef Lorenz Rumberger, Manuel Pfeuffer, Sonja Greven, Klaus Maier-Hein, Carsten T. Lüth, Christoph Karg, Dagmar Kainmueller
Organizations: Max-Delbrück-Center (MDC) · Helmholtz Imaging · University of Potsdam · Charité Universitätsmedizin · Humboldt-Universität zu Berlin · German Cancer Research Center (DKFZ) · Heidelberg University
Uncertainty Quantification (UQ) is crucial for ensuring the reliability of automated image segmentations in safety-critical domains like biomedical image analysis or autonomous driving. In segmentation, UQ generates pixel-wise uncertainty scores that must be aggregated into image-level scores for downstream tasks like Out-of-Distribution (OoD) or failure detection. Despite routine use of aggregation strategies, their properties and impact on downstream task performance have not yet been comprehensively studied. Global Average is the default choice, yet it does not account for spatial and structural features of segmentation uncertainty. Alternatives like patch-, class- and threshold-based strategies exist, but lack systematic comparison, leading to inconsistent reporting and unclear best practices. We address this gap by (1) formally analyzing properties, limitations, and pitfalls of common strategies; (2) proposing novel strategies that incorporate spatial uncertainty structure and (3) benchmarking their performance on OoD and failure detection across ten datasets that vary in image geometry and structure. We find that aggregators leveraging spatial structure yield stronger performance in both downstream tasks studied. However, the performance of individual aggregators depends heavily on dataset characteristics, so we (4) propose a meta-aggregator that integrates multiple aggregators and performs robustly across datasets.
Figures & tables
Figure 1: Aggregation strategies (AggS). (a) An AggS reduces an uncertainty map to a single scalar score. (b) Empirical evaluation of AggSs. Choosing an appropriate AggS is challenging and highly task-dependent. Hence, we benchmark different strategies in the context of OoD- and failure detection over different datasets. (c) Limitations of individual AggSs. Pixel-wise strategies, in particular, have key shortcomings e.g . 1. AVG ignores spatial structure ; 2. AQA lacks proportional invariance ; and 3. ATA is not monotonic (see Supp. A for more details). (d) Subtypes of AggSs. Beyond pixel-wise AggSs, we also explore spatially-aware approaches—such as prediction-based and spatial AggSs, which measure the fraction of uncertainty mass within structured regions of the uncertainty map. Finally, we consider Meta-AggSs, which combine intensity-based and spatial strategies by fitting a Gaussian Mixture Model (GMM).
Figure 2: Structural diversity of datasets. The scatterplot illustrates structural diversity by projecting uncertainty maps into the space of two SMR scores: MOR and EDS. High MOR indicates clustered uncertainty (low: noise), while high EDS reflects edge-localized uncertainty (low: flat regions). Notably, EDS effectively identifies OoD samples in CAR-ID/CAR-CS.
Figure 3: Performance on OoD Detection. Higher AUROC (0.6–1.0) indicates better iD–OoD separation. AggSs are ranked by their mean AUROC, computed over 500 bootstrap samples per dataset and then averaged across datasets for stability. Ranking robustness is assessed via one-sided Wilcoxon signed-rank tests at 5%, showing that prediction-based BCA and ICA, along with GMM-based methods, form a statistically dominant tier ( p<0.05 ). Numbers after AggS labels indicate method-specific parameters (cf. Supp. A.1 ). Full analysis, including additional UQ methods and confidence intervals, is in Supp. C .
Figure 4: GMM Robustness for OoD Detection. (a) Fitting a GMM enables spatial methods to act as AggSs, capturing subtle non-linear changes in uncertainty maps. (b) Qualitative examples showing that effective AggSs for iD–OoD separation are data-dependent. (c) GMM-All AUROC: leave-one-out (top) and individual fitting (bottom) on a subset (CAR-CS, LIZ-IG, WEED-Hand, and WORM-Nem split). Using all AggSs generally matches or outperforms individual ones in 3 cases, with minimal impact from removing specific ones. Exceptions occur when a feature dominates ( e.g . , EDS for CAR-CS, marked as Tukey outlier) or when features lack discriminative power. (d) GMM-All AUROC: absolute SHAP values. Positive values indicate that an AggS aids GMM-All in separating iD–OoD; bi-directional or null contributions reduce performance (e.g., in LIZ-IG). SHAP values are shown for the same subsets as in (c).
Figure 5: Performance on FD. (a) Exemplary Selective Risk-Coverage curves . (b) E-AURC scores . Lower values indicate better alignment between uncertainty and prediction errors. AggSs are ranked by their mean E-AURC, computed over 500 bootstrap samples per dataset and then averaged across datasets for stability. Ranking robustness is assessed via one-sided Wilcoxon signed-rank tests at 5%, showing that prediction-based QFR shows statistically significant improvement over all other AggSs ( p<0.001 ), followed by BCA and GMM-based methods ( p<0.05 ). Full analysis, including additional UQ methods and confidence intervals, is in Supp. C .
PF
M
PI
L
Global Average (AVG)
✓
✓
✗
✗
Above-Threshold Average (ATA)
✗
✗
✓
✗
Above-Quantile Average (AQA)
✗
✓
✗
✗
Patch-Level Maximum (PLM)
✗
✓
✓
✓
Weighted Class Average (WCA)
✗
✓
✗ ∗
✗
Table A.1 : Overview of key properties of selected AggSs. PF: Parameter-free, M: Monotonic, PI: Proportion invariant, L: Local. ∗ WCA becomes proportion invariant when the background class is excluded in specific use cases where foreground classes exhibit high uncertainty and the background class has low uncertainty.
Figure A.1 : Non-monotonicity of ATA. Left is shown a 3×3 uncertainty map. If we increase each pixel value by Δ the ATA score (threshold T=0.7 ) will drop at a value of Δ=0.1 , since the amount of pixels affecting the average suddenly increases as their values pass the threshold.
Figure B.1 : Spatial decomposition using Moran’s I. For an uncertainty map U we compute the pixelwise local spatial measure w.r.t. to Moran’s I which captures noise ( I=0 ) and clusters ( I=1 ). The local spatial measures can be interpreted as weights of a weight matrix W where high weights correspond to high spatial auto-correlation. The pixelwise product of U and W is Uhigh while the pixelwise product of U and 1−W is Ulow , which yields a matrix decomposition of the original uncertainty map.
a AUROC
BCA
.72 ± .06
.79 ± .05
.89 ± .01
.57 ± .05
.82 ± .07
.68 ± .02
.68 ± .02
.58 ± .06
.77 ± .06
.95 ± .02
5.2
GMM-All
.84 ± .05
.87 ± .05
1.00 ± .00
.86 ± .03
.77 ± .05
.45 ± .03
.44 ± .03
.95 ± .03
1.00 ± .00
1.00 ± .00
5.2
ICA
.60 ± .07
.83 ± .05
.84 ± .02
.57 ± .05
.82 ± .07
.71 ± .02
.59 ± .03
.57 ± .06
.77 ± .06
.95 ± .02
5.9
GMM-Int
.79 ± .06
.83 ± .06
.73 ± .02
.86 ± .03
.78 ± .05
.49 ± .03
.43 ± .03
.91 ± .04
.98 ± .01
1.00 ± .00
6.0
QFR
.62 ± .07
.86 ± .04
.62 ± .02
.54 ± .05
.89 ± .05
.68 ± .03
.57 ± .03
.58 ± .06
.67 ± .06
.91 ± .03
6.6
GMM-Spa
.93 ± .03
.66 ± .07
1.00 ± .00
.67 ± .04
.72 ± .07
.49 ± .03
.41 ± .03
.85 ± .05
.89 ± .04
.90 ± .03
7.1
Table C.1 : Performance of AggSs on uncertainty maps generated with MC Dropout (MCD) in OoD and failure detection. Columns are color-coded with a red-to-green gradient, where white represents the mean (for AUROC this is equivalent to random guessing). (a) Higher AUROC values (greener cells, 0.6–1.0) indicate better iD vs. OoD separation, while (b) lower E-AURC values (greener) indicate better alignment between uncertainty estimates and prediction errors. AggSs are ranked from best (top) to worst (bottom) based on their average metric, first computed across 500 bootstrap samples per dataset, and then averaged across datasets to ensure stable rankings (rightmost column). Each value is reported with the standard deviation across bootstrap samples. These tables complement Figures 3 and 5 b.
a AUROC
GMM-All
.81 ± .05
.85 ± .05
1.00 ± .00
.92 ± .03
.55 ± .08
.55 ± .03
.45 ± .03
.93 ± .03
.99 ± .01
1.00 ± .00
5.4
BCA
.87 ± .04
.75 ± .06
.90 ± .01
.60 ± .05
.64 ± .09
.66 ± .02
.73 ± .02
.62 ± .06
.69 ± .06
.86 ± .04
5.6
ICA
.83 ± .05
.78 ± .06
.80 ± .02
.61 ± .05
.64 ± .09
.70 ± .02
.66 ± .02
.61 ± .06
.68 ± .06
.86 ± .03
5.9
QFR
.85 ± .05
.81 ± .06
.56 ± .02
.60 ± .05
.62 ± .08
.73 ± .02
.71 ± .02
.60 ± .06
.66 ± .06
.89 ± .03
5.9
GMM-Int
.81 ± .05
.76 ± .06
.80 ± .02
.91 ± .03
.58 ± .07
.52 ± .03
.46 ± .03
.94 ± .03
.99 ± .01
1.00 ± .00
6.3
GMM-Spa
.84 ± .06
.73 ± .07
1.00 ± .00
.70 ± .05
.58 ± .07
.51 ± .02
.52 ± .03
.89 ± .03
.82 ± .05
.87 ± .04
6.7
Table C.2 : AggSs performance on uncertainty maps generated with Maximum Softmax Probability (MSP) in OoD and failure detection. Color coding and metric interpretation are as detailed in Table A.1. (a)-(b) AggSs are ranked from best (top) to worst (bottom) based on their average metric, first computed across 500 bootstrap samples per dataset, and then averaged across datasets to ensure stable rankings. Each value is reported with the std. deviation across bootstrap samples.
a AUROC
GMM-All
.83 ± .05
.84 ± .06
.99 ± .00
.86 ± .03
.70 ± .07
4.8
QFR
.90 ± .04
.81 ± .06
.67 ± .02
.77 ± .04
.88 ± .04
4.8
GMM-Spa
.93 ± .03
.72 ± .06
1.00 ± .00
.83 ± .03
.70 ± .06
5.0
BCA
.89 ± .04
.76 ± .06
.93 ± .01
.71 ± .04
.82 ± .06
5.2
ICA
.88 ± .05
.79 ± .06
.89 ± .01
.70 ± .04
.82 ± .07
5.4
GMM-Int
.79 ± .05
.76 ± .06
.79 ± .02
.89 ± .03
.68 ± .06
6.4
Table C.3 : AggSs performance on ensembling heatmaps in OoD and failure detection. Color coding and metric interpretation are as detailed in Table A.1. (a)-(b) AggSs are ranked from best (top) to worst (bottom) based on their average metric, first computed across 500 bootstrap samples per dataset, and then averaged across datasets to ensure stable rankings. Each value is reported with the std. deviation across bootstrap samples.
a AUROC
QFR
.85 ± .05
.88 ± .04
.68 ± .04
.81 ± .07
4.5
BCA
.81 ± .06
.87 ± .04
.70 ± .04
.73 ± .09
5.0
GMM-All
.72 ± .07
.88 ± .05
.89 ± .03
.73 ± .05
5.0
ICA
.74 ± .06
.88 ± .04
.70 ± .04
.72 ± .09
5.5
AQA .9
.81 ± .05
.74 ± .06
.95 ± .02
.51 ± .06
6.5
PLM 20
.73 ± .06
.78 ± .06
.95 ± .02
.50 ± .07
6.8
Table C.4 : AggSs performance on TTA heatmaps AggSs in OoD and failure detection. Color coding and metric interpretation are as detailed in Table A.1. (a)-(b) AggSs are ranked from best (top) to worst (bottom) based on their average metric, first computed across 500 bootstrap samples per dataset, and then averaged across datasets to ensure stable rankings. Each value is reported with the std. deviation across bootstrap samples.
Figure D.1 : Illustration of dataset diversity as captured by different aggregation measures. Unlike the projection of uncertainty maps into EDS–MOR space (cf. Fig. 2 , with non-highlighted datasets shown in gray), projections onto spaces defined by randomly chosen pairs of pixel-intensities or prediction-aware AggSs do not reveal a clear separation of the datasets. Nevertheless, the two-dimensional configuration of CAR-ID and CAR-CS points suggests that a separation might emerge in a multidimensional space incorporating all AggSs.
Dataset
iD Samples
OoD Samples
ARC-BC
25
50
ARC-Nuc
25
50
LIDC-Mal
53
93
LIDC-Tex
84
20
WORM-Nem
25
47
WORM-Pro
25
82
Table D.1 : Sample counts for iD and OoD splits across evaluation datasets.
Figure G.1 : Effect of PCA. Example of feature collapse resulting from computing a 1D PCA projection in 2D space using only iD samples, and subsequently applying this projection to both iD and OoD samples. The resulting histogram (inset) illustrates that this approach yields poor separability between iD and OoD data.
Figure G.2 : Data Normalization. AUROC scores from our OOD detection experiment are shown for four different normalization methods: Beta CDF Gaussianizer, Standard Scaler, Quantile Transformer, and no normalization. The three bar plots represent the performance of the methods GMM-All , GMM-Int , and GMM-Spa under each normalization setting.
Figure G.3 : Utilizing spatial measures as AggSs. Histograms of individual AggSs for CAR-ID and CAR-CS are shown along with: 1. a GMM fitted on an an iD subset of the individual score (solid line), and 2. the diagonal component of a GMM fitted on all scores (dotted line). This empirically shows that spatial measures can be leveraged by a GMM to detect OoD samples, even when the shift from iD to OoD is toward lower aggregated values.
Figure G.4 : GMM Robustness for OoD Detection for all datasets. (a) GMM-All AUROC: leave-one-out (top) and individual fitting (bottom). Using all AggSs generally matches or outperforms individual ones in 6 of 10 cases, with minimal impact from removing specific AggSs. Exceptions occur when a feature dominates ( e.g . , EDS for CAR-CS or ICA in LIDC-MAL, marked in red as Tukey outliers) or when features lack discriminative power between iD and OoD samples ( e.g . , LIZ-SG). The most discriminative AggSs for ARC-BC, ARC-Nuc, CAR-CS, LIDC-MAL, and WEED-Hand are typically spatial mass ratios or prediction-based (proportion-invariant). (b) GMM-All AUROC: absolute SHAP values. Positive values indicate that an AggS helps GMM-All separate iD–OoD, confirming the results observed in (a); bi-directional or null contributions reduce performance (e.g., in LIZ-IG).
Figure G.5 : AggSs behavior under gradual perturbations. For varying perturbation levels of a) ARC-Nuc and b) ARC-BC we display the sample-wise behavior of selected AggSs, i.e. an increase with increasing perturbation parameter manipulation is marked as light blue connection, a decrease as red arrow. The overall fraction between de- and increases is inset in the upper left corner of each AggSs plot.