Skip to content
AI360XpertBeta

Uncertainty Estimation in Vision

A softmax score of 0.97 can still be a guess. Uncertainty estimation measures disagreement across predictions, so strange inputs route to humans before they cause harm.

Ensemble variance reads 0.020 on strange inputs against 0.0003 on familiar ones, so a threshold near 0.005 routes guesses to review.
Ensemble variance reads 0.020 on strange inputs against 0.0003 on familiar ones, so a threshold near 0.005 routes guesses to review.

Why Does This Exist?

A classifier returns a full probability vector on every input, including inputs nothing like its training data: a sketch, a night shot, a new sensor. The top score still looks confident, because softmax must sum to 1. Acting on that confidence produces the worst failures, from wrong triage to phantom braking.

Uncertainty estimation separates what the model knows from what it guesses. Ensembles and dropout sampling measure disagreement across predictions; calibration checks whether stated confidence matches accuracy; selective prediction routes the uncertain fraction to humans. This page covers disagreement-based scores and the abstention threshold. The two uncertainty kinds live in aleatoric versus epistemic uncertainty.

Think of It Like This

Five radiologists voting independently

One radiologist always names something, even on a blurry scan. Five independent radiologists who agree 5 to 0 are trustworthy; a 3 to 2 split with hedged language means calling the specialist. The vote spread, not any single vote, carries the doubt.

Ensembles are those five votes. Low variance means the models independently converged; high variance means the input sits where training gave no consensus. The analogy stops at cost: five radiologists bill five times, and so do five models, which is why cheaper approximations such as dropout sampling exist.

How It Actually Works

Ensemble variance and predictive entropy

Train MM models from different seeds, or run one dropout model MM times with dropout left on (Monte Carlo dropout). For an input, let pmp_m be model mm's predicted probability for the top class, with mean pˉ=(1/M)∑mpm\bar{p} = (1/M) \sum_m p_m. The disagreement score is the variance σ2=(1/M)∑m(pm−pˉ)2\sigma^2 = (1/M) \sum_m (p_m - \bar{p})^2: near zero when the members agree, large when they scatter. The fuller summary is the predictive entropy H=−∑cpˉcln⁡pˉcH = -\sum_c \bar{p}_c \ln \bar{p}_c over classes cc, which also grows when the averaged distribution spreads out. Model-side doubt that more data would shrink is epistemic; noise baked into the input itself is aleatoric. Pick an abstention threshold τ\tau on held-out data: inputs with σ2>τ\sigma^2 > \tau say unsure and route to review instead of answering.

Worked five-model example

Five models score one familiar photo with top-class probabilities [0.82,0.85,0.80,0.83,0.81][0.82, 0.85, 0.80, 0.83, 0.81]. The mean is pˉ=4.11/5=0.822\bar{p} = 4.11/5 = 0.822, and the variance is σ2=(0.000004+0.000784+0.000484+0.000064+0.000144)/5=0.00148/5=0.0003\sigma^2 = (0.000004 + 0.000784 + 0.000484 + 0.000064 + 0.000144)/5 = 0.00148/5 = 0.0003. The same ensemble scores a corrupted frame at [0.45,0.70,0.30,0.60,0.40][0.45, 0.70, 0.30, 0.60, 0.40]: mean 2.45/5=0.492.45/5 = 0.49 and variance (0.0016+0.0441+0.0361+0.0121+0.0081)/5=0.102/5=0.0204(0.0016 + 0.0441 + 0.0361 + 0.0121 + 0.0081)/5 = 0.102/5 = 0.0204. The strange input disagrees about 69 times more (0.0204/0.0003=68.90.0204/0.0003 = 68.9), so a threshold such as τ=0.005\tau = 0.005 keeps the familiar photo and routes the corrupted one.

Code

import statistics
familiar = [0.82, 0.85, 0.80, 0.83, 0.81]strange = [0.45, 0.70, 0.30, 0.60, 0.40]print(round(statistics.pvariance(familiar), 4))# -> 0.0003print(round(statistics.pvariance(strange), 4))# -> 0.0204print(round(statistics.pvariance(strange) / statistics.pvariance(familiar), 1))# -> 68.9

Watch Out For

Tuning the threshold on the test set

A threshold picked to maximize answered accuracy on the evaluation set bakes in that set's corruption mix. The symptom is a deployed router that abstains constantly or never once the mix shifts. Tune τ\tau on a separate held-out split with a documented cost ratio for wrong answers versus delayed ones.

Agreement mistaken for correctness

Low variance means the members agree, not that they are right: five models sharing one blind spot vote together confidently. The symptom is unanimous wrong answers on a shifted slice. Pair the threshold with calibration checks and slice evaluations instead of trusting agreement alone.

The Quick Version

  • Softmax confidence must sum to 1, so it cannot mark strange inputs; disagreement across runs can.
  • Five-model variance near 0.0003 means familiar, near 0.020 means strange, about a 69-fold gap.
  • A threshold such as 0.005 routes high-variance inputs to review instead of answering them.
  • Predictive entropy over the averaged distribution summarizes the same doubt in one number.
  • Tune thresholds on held-out data, and never read agreement as proof of correctness.