A confidence score in computer vision is the number a model attaches to each prediction to say how sure it is. In an object detector it is usually the product of an objectness score (how likely the box contains an object) and a class probability (how likely that object belongs to a class). By default it cannot be read as the probability that the prediction is correct. Deep networks with high accuracy are often poorly calibrated, so their predicted probabilities can be overconfident or underconfident. Whether a model’s scores match real outcomes is measured on held-out data, using reliability diagrams, Expected Calibration Error (ECE) and, for interval outputs, coverage tests.
The sections below apply these checks in turn to a detector on an inspection line, a default-probability model and a remaining-useful-life estimator.
How a Detector Builds Its Confidence Score
The detection confidence score combines two quantities. The box confidence is the model’s certainty that a bounding box contains an object. The class confidence is the probability of a specific class, given that an object is present. The final score multiplies the two. Early YOLO formulations wrote it as p(object) × IoU between the predicted box and the ground truth, and then used non-maximum suppression to remove overlapping boxes.
Training pushes the score towards a target. Nothing in that process guarantees that the score matches how often detections at that level are actually right. One review of calibration metrics notes that detection-specific calibration measures reach their optimum when the detector outputs confidence equal to the IoU of the correct class. That target is overlap between the predicted and ground-truth box, not a frequency of being right.
For confidence scores in language models, see our piece on AI confidence scores in LLM evaluation.
Why a Confidence Score of 0.9 Does Not Mean 90% Correct
A classifier is calibrated when its confidence equals the probability that its prediction is correct. In Guo et al. (2017), using ECE with 15 bins, most datasets and models tested showed ECE between 4% and 10%, across network types alike. They also found that miscalibration got worse even as classification error went down, and that capacity, normalisation and regularisation strongly affect calibration.
So a more accurate model is not automatically a better calibrated one. A 2021 study of ECE estimators says almost all classifiers in current use are not intrinsically well calibrated, so their output scores cannot be read as probabilities. Treat that as the default assumption for any detector you did not calibrate yourself.
Reading a Reliability Diagram
A reliability diagram groups predictions into bins by confidence and plots each bin’s observed accuracy against its mean confidence. The diagonal is perfect calibration, where confidence equals accuracy in every bin. A bin whose accuracy falls short of its confidence is overconfident. A bin whose accuracy beats its confidence is underconfident. Which side of the diagonal means which depends on the axis that carries accuracy, so check the axes before you read the gaps.
Both patterns show up in practice. Guo et al. (2017) show an uncalibrated 110-layer ResNet on CIFAR-100 that is overconfident. A study of non-parametric calibration for classification reports that PNASNet-5-Large, and other high-accuracy CNNs on ImageNet, were less confident than accurate across much of the confidence range.
There is one reading rule worth keeping. Bins with few samples have high variance in their per-bin accuracy. The same authors flag a large deviation in the left-most bin of one of their own diagrams as an artefact of low sample count, not evidence of real miscalibration. A dramatic bar over twenty predictions tells you less than a modest gap over two thousand.
Expected Calibration Error and Why the Bin Count Matters
ECE summarises the reliability diagram in one number. It divides predictions into bins by predicted probability, takes the absolute gap between mean confidence and observed frequency in each bin, and averages those gaps weighted by bin size. An ECE value needs its bin count, its binning scheme and its sample size stated, because all three change the number.
Published practice varies. Guo et al. (2017) used 15 bins. A study of non-parametric calibration for classification deliberately chose 100 bins, while noting that the number of bins is limited by the number of test samples, because within-bin variance rises with the number of bins. A 2026 study of medical vision-language models used 10 equal-width bins. These choices are not interchangeable: for a given model, more bins give higher ECE and Maximum Calibration Error. With finite data, a binned ECE can either underestimate or overestimate the true calibration error.
Sample size is a further limit. A 2021 study of ECE estimators found that every estimator it tested had an error of around 10% of the true value in small-data regimes, and concluded that calibration should not be evaluated on that little data, whatever the estimator. The same study tests a simple heuristic of setting the bin count to the square root of the sample count. Adaptive binning, where each bin holds the same number of samples, is another way to reduce the bias that fixed bin widths introduce.
Three more limits matter when ECE goes into a report:
- Calibration is not usefulness. On a balanced binary problem, a model that always outputs 0.5 is perfectly calibrated and tells you nothing, which is why sharpness has to be judged alongside calibration.
- ECE is global. It does not guarantee calibration for individual cases and can ignore rare categories.
- A non-zero ECE is not automatically a failure. Finite datasets produce non-zero values even for a perfectly calibrated model, so the real question is whether the value is statistically different from zero.
Detection ECE Is a Different Metric
Detection differs from the classification set-up. A detector can declare any number of detections per image, missed objects have no confidence attached, and true negatives are hard to define. Detection versions of ECE use precision in place of accuracy. Because low-confidence detections cluster near zero, the first bin can dominate the result. One response is a bin-based average calibration error that gives every bin equal weight instead of weighting by count, so the mass of low-confidence detections cannot wash out the metric. “ACE” is also used for the adaptive, equal-mass calibration error in classification, so state which one a report means.
Detection calibration is also a separate question from detection accuracy. Calibration metrics give an assessment that complements accuracy metrics such as precision, recall, mAP and IoU.
Temperature Scaling, the First Fix to Try
Temperature scaling divides the logit vector by a single scalar T > 0 before the softmax. T is fitted by minimising negative log-likelihood on a held-out validation set. T > 1 softens the distribution, T = 1 leaves the original probabilities unchanged, and very small T collapses them towards a point mass. T does not change which class has the highest score, so the predicted class stays the same and accuracy is unaffected.
In Guo et al. (2017), temperature scaling beat every other method they tested on the vision tasks, including more expressive vector and matrix Platt scaling. It is also cheap: fitting it is a one-dimensional convex optimisation that converges in about 10 conjugate-gradient iterations. Binning-based recalibration also improved calibration on most datasets, but tended to change class predictions and so cost accuracy.
The trade-off is expressiveness. Post-hoc calibration works without much validation data, but struggles to approximate the true calibration function when data is short. Temperature scaling is accuracy-preserving and data-efficient but less expressive.
Confidence Thresholds: What Calibration Does and Does Not Tell You
Detector tooling exposes the threshold as a setting. The Ultralytics YOLO configuration documentation describes a validation conf of 0.001: lower values raise recall but may add false positives, and a higher value such as 0.25 gives a confusion matrix closer to prediction output but can lower mAP. The two numbers do different jobs. The low value feeds the precision-recall curves and mAP, while a higher value such as 0.25 is closer to what prediction output uses.
A low ECE does not pick the threshold for you. The 2026 medical vision-language model study argues that AUROC and ECE both describe a score on average, and neither tells you how much of a workload can be accepted at a controlled error rate. In that study, a threshold chosen on calibration data without a statistical bound exceeded a 20% error tolerance on the test half in 409 of 778 cases. Thresholds certified with a confidence bound exceeded it in 1 of 210. The authors also warn that a certified threshold only holds when the calibration data and the data it is used on are exchangeable, and fails under shift. The calibration set and its date therefore belong in the threshold’s documentation. Our piece on why off-the-shelf computer vision models fail in production covers shift further.
Binary vs Multi-Class Classification Comparison: Calibration on the Same Event
To find out whether a binary model and a multi-class or ordinal alternative are equivalent, backtest both on the same held-out data. Report discrimination (AUC) and calibration (ECE with a reliability diagram) for each, and judge the differences against a tolerance agreed before anyone sees the results. In credit scoring, the question is whether a binary default model might be replaced by cross-entropy over delinquency buckets. In inspection, the parallel case is a pass/fail head becoming a defect-type head.
LynxBenchAI runs this backtest for you, scoring the binary and multi-class variants on the same held-out data and reporting AUC and calibration deltas against the agreed tolerance; the first step is agreeing that tolerance with your stakeholders.
TechnoLynx agrees the backtest protocol and equivalence criteria with your risk or quality stakeholders, implements both variants on your historical data, and reports AUC and calibration deltas against the agreed tolerance.
A binary vs multi-class classification comparison only works if both models are scored on the same event. For a multi-class model, derive the probability of the binary event from its outputs (for example, the sum over the buckets that count as default) and calibrate that, not the top label. Multi-class calibration can be defined several ways: top-label confidence is the most common, and classwise ECE averages calibration across each class separately.
Treat discrimination and calibration as separate results, because they measure different properties. That separation decides what a gap means. Temperature scaling does not change which class is predicted, so it leaves accuracy unchanged and only changes how confident the scores are.
Three conditions make the backtest fair:
- the labels are harmonised identically across the binary and multi-class targets;
- calibration is measured on an out-of-time sample that represents current conditions;
- you accept that statistical equivalence may not be enough on its own where a regulator or quality board also asks for explainability of the chosen formulation.
Hosmer-Lemeshow, Brier Score and the Tests Behind a Threshold Change
For a binary score whose cutoff is changing, we would gather three kinds of statistical evidence:
- Calibration: a calibration curve or Hosmer-Lemeshow test, plus the Brier score.
- Discrimination: the Kolmogorov-Smirnov (KS) statistic or AUC.
- Population stability: a check that today’s population still looks like the one the threshold was set on.
TechnoLynx’s AI Governance and Trust work covers the assurance side of model changes like this.
The Hosmer-Lemeshow statistic is widely used for binary classifiers, especially in medicine. Its “c-statistic” form is equivalent to equal-mass binning with 10 bins, and its “h-statistic” form to equal-width binning with 10 bins. That makes it a binned test, open to the general problems of bin-based schemes. Like any significance test, it becomes very sensitive at very large sample sizes, where tiny miscalibrations still reject.
The Brier score is a strictly proper score that decomposes into reliability, resolution and uncertainty terms. The reliability term is the calibration loss. The Brier score also conflates accuracy with calibration.
Which tests are required, and at what thresholds, depends on the institution’s model risk policy, so treat this as a starting checklist. For how individual metrics map onto a documented evidence pack, see what each model performance metric actually proves.
How Do We Test That a 90% Interval Really Contains the Outcome 90% of the Time?
Count it. On held-out cases, record how often the true outcome falls inside the predicted interval. That share is the prediction interval coverage probability (PICP), and for a calibrated 90% interval it should be close to 90%. Remaining-useful-life estimators that set financial reserves need this check most, because a plausible-looking interval is not evidence of coverage.
LynxBenchAI runs this coverage check on an estimator’s held-out outputs, reporting observed coverage against the nominal level; the first step is sharing the held-out cases with their recorded outcomes.
TechnoLynx designs the cross-validation scheme for sparse, censored failure data, runs the coverage and calibration assessment on the estimator’s outputs, and iterates on the model or its calibration until the bounds meet the required coverage. TechnoLynx delivers this under its Production AI Reliability practice.
Calibration is checked across a series of coverage levels, not one. Plot observed coverage against nominal coverage across a range of levels. For a calibrated model the curve sits on the identity line, and the histogram of probability integral transform values is uniform. Standard maximum likelihood training leaves 90% intervals that typically do not contain the outcome 90% of the time.
Calibration is also only half the story. A calibrated interval should be as narrow as possible, and that property is called sharpness.
When There Is Hardly Any Failure Data to Hold Out
With few failures, a single large holdout starves either training or evaluation. A study of uncertainty calibration in computational chemistry uses leave-one-out or k-fold cross-validation instead. It estimates intervals on each learning split, tests them on the held-out split, and pools the results into PICP estimates. The same study shows how much data a firm conclusion needs: rejecting the hypothesis that an observed PICP of 0.99 equals a 0.95 target takes at least 150 points to reach a power of 0.8. With fewer failures than that, report the coverage estimate with its interval and accept that the estimate is noisy.
Conformal prediction is the other route. It turns any heuristic uncertainty score into prediction sets or intervals with distribution-free coverage guarantees. That guarantee is marginal, not conditional on each input. Small calibration sets also cause trouble: in split conformal prediction, average coverage over many calibration draws equals the target, but the coverage from one particular calibration set can vary substantially. In one 2025 small-data study, uncorrected split conformal fell below 90% coverage in roughly 39% to 41% of calibration draws. Under covariate shift, weighted conformal prediction upweights calibration points that look more like the new distribution.
Coverage can also hold overall and fail locally. Running PICP tests on subsets of the validation data shows where intervals are too narrow or too wide. For subgroups and sites, see our piece on validating confidence-score calibration for multi-site tumour classification. Even perfect coverage only shows statistical calibration. It does not show that the model’s structure is right.
Choosing the Calibration Check for Each Kind of Output
| Model output | What to compare against outcomes | Primary check | Caveat to state in the report |
|---|---|---|---|
| Classifier softmax score | Accuracy per confidence bin | Reliability diagram, ECE with stated bins | ECE rises with bin count and is unreliable on small samples |
| Detector confidence (objectness × class) | Precision per confidence bin | Detection ECE, or equal-weight average calibration error | Low-confidence detections dominate the first bin |
| Binary risk score with a cutoff | Observed event rate per score group | Calibration curve, Hosmer-Lemeshow, Brier score | Hosmer-Lemeshow depends on its binning |
| Prediction interval | Share of outcomes inside the interval | PICP across levels, calibration curve | About 150 points needed to tell 0.99 from 0.95 at power 0.8 |
| Any score turned into a guarantee | Share of outcomes inside the prediction set | Split or weighted conformal prediction | Coverage is marginal and varies with small calibration sets |
Who Can Check Whether Our Model’s Confidence Scores Hold up in Production?
TechnoLynx assesses whether a model’s scores and uncertainty bounds match real outcomes, adjusting calibration until bounds meet required coverage. For a scoring model, that means AUC, ECE and reliability diagrams for each candidate, reported against an agreed tolerance. For interval outputs, it means coverage testing designed around how much outcome data actually exists. An engagement starts by agreeing the backtest protocol and equivalence criteria with your risk or compliance stakeholders.
An engagement is the wrong fit if you only need one ECE figure on a public benchmark: any team with a held-out set and the definitions above can compute that. It is also the wrong fit where the real need is regulatory sign-off or clinical judgement. We supply the engineering evidence; domain authority stays with the regulator or the clinical team.
FAQ
Is Binary Cross-Entropy the Same as Log Loss?
Yes. For a binary target, binary cross-entropy and log loss are the same quantity: the negative log-likelihood of the true label under the predicted probability. Negative log-likelihood is a strictly proper score, but it mixes accuracy and calibration, so a low value alone does not show the model is calibrated.
What Is Hold-Out Validation?
Hold-out validation keeps part of the labelled data out of training and evaluates the model only on that part. Calibration methods typically fit the calibration map on a small held-out calibration set.