Skip to content
AI.info

Computer vision

Image Classification Systems

Design and evaluate image classifiers with coherent taxonomies, baselines, calibration, abstention, and shortcut analysis.

By the end you can

Example

The model that classified the hospital

Can a convolutional network tell you which hospital a chest radiograph came from, using nothing but the image? Zech and colleagues asked that in PLOS Medicine in 2018. The answer was yes. The network assigned 99.95% of NIH images to the correct source system — 22,050 of 22,062 — and 99.98% of Mount Sinai images, 8,386 of 8,388.

That cue has a price. Their best pneumonia model, trained on pooled MSH and NIH data, scored AUC 0.931 (95% CI 0.927-0.936) on internal data. At Indiana University, a site absent from training, it scored 0.815 (95% CI 0.745-0.885). P = 0.001.

The case now opens a 2020 survey of shortcut learning in deep neural networks, by Geirhos and colleagues: “Worse yet, a machine classifier successfully detected pneumonia from X-ray scans of a number of hospitals, but its performance was surprisingly low for scans from novel hospitals: The model had unexpectedly learned to identify particular hospital systems with near-perfect accuracy (e.g. by detecting a hospital-specific metal token on the scan, see Figure 1).”

The network solved a stable statistical problem. It did not solve the intended clinical one. Correct labels did not prevent shortcut learning.

  • Training cue: the source hospital system is legible in the image itself — Geirhos and co-authors name a hospital-specific metal token as one carrier.
  • Scale of the cue: 99.95% of NIH images (22,050/22,062) and 99.98% of Mount Sinai images (8,386/8,388) were traced to the correct site.
  • Validation flaw: an internal split shares sites with training, so a site detector is rewarded by the score rather than exposed by it.
  • Deployment shift: AUC 0.931 (95% CI 0.927-0.936) on pooled MSH and NIH data against 0.815 (95% CI 0.745-0.885) at Indiana University, P = 0.001.
  • Repair: evaluate at a site the model has never seen, and report the internal-versus-external gap as the headline number instead of the internal one.

Visual

Classification is more than an argmax

A production classifier combines model outputs with rules about uncertainty and action. Steps 3 and 4 are where most of this lesson lives. A score becomes a probability only after someone calibrates it on a named population. It becomes a decision only after someone writes down what happens when the evidence is thin.

FigureProcess · 5 steps
  1. 1. Define classes

    Create labels that are observable, useful, and distinguishable.

  2. 2. Produce scores

    The model estimates evidence for each class under its training objective.

  3. 3. Calibrate or validate confidence

    Check whether scores support the intended uncertainty interpretation.

  4. 4. Apply decision policy

    Use thresholds, costs, abstention, and business constraints.

  5. 5. Monitor outcomes

    Measure errors, shifts, review load, and downstream consequences.

Comparison

Single label, multilabel, open set, and hierarchical decisions

These settings need different targets and output policies. The reject option is the one teams treat as an optional nicety. A regulator has already treated it as part of the authorised product.

IDx-DR ships three answers, not two: more than mild DR detected, more than mild DR not detected, or insufficient quality. The FDA authorised it that way in April 2018, as a new Class II device type, under submission DEN180001. The pivotal study ran 900 patients at 10 primary-care sites. Of the 857 participants with a completed reading-centre grading, 38 (4%) received the insufficient-quality output — imageability 96.1% (95% CI 94.0-96.8%). Observed sensitivity was 87.4% (95% CI 81.9%-92.9%) and observed specificity 89.5% (95% CI 86.9%-93.1%).

The figure worth carrying out of the decision summary is the one about the cases the system refused: “In the 38 participants with AI system insufficient image quality, the prevalence of mtmDR was 10/38 (26%), comparable to the mtmDR prevalence in the fully analyzable dataset.” In the analysable set the rate was 23.8%, 198 of 819. So the declined cases were not the low-risk residue that abstention is usually imagined to collect. They carried the disease at the same rate as the cases the system decided. An abstention is a referral with a queue behind it, not a discard.

The sponsor's own report of the same trial gives sensitivity 87.2% (95% CI 81.8-91.2%), specificity 90.7% (95% CI 88.3-92.7%) and imageability 96.1% (95% CI 94.6-97.3%), against pre-specified thresholds of >85% and >82.5%. Near the regulator's numbers, and not identical to them. Which document you are quoting is part of the claim.

FigureComparison · 4 columns

Single-label closed set

Exactly one known class is selected.

  • Often uses normalized class scores
  • Classes should be mutually exclusive
  • Failure: forced choice on unknown input
  • Example: document category

Multilabel

Several attributes may be true together.

  • Uses independent or structured labels
  • Requires per-label thresholds
  • Failure: co-occurrence shortcuts
  • Example: scene tags

Hierarchical classification

Labels live in a taxonomy with coarse and fine levels.

  • Can predict at several depths
  • Errors have semantic distance
  • Failure: inconsistent parent-child outputs
  • Example: product catalog

Open-set or reject option

The system can decline known-class assignment.

  • Needs unknown and low-evidence cases
  • Thresholds depend on population
  • Failure: overconfident forced match
  • Example: visual inspection intake

A taxonomy is a product specification

Classes should correspond to decisions the system can support from available pixels. If experts need metadata or history to distinguish two labels, an image-only model may face an impossible target.

Class definitions should cover “other,” uncertain, mixed, damaged, and out-of-scope cases. The ontology must also specify whether labels describe objects, scenes, states, or causes.

In 2020 a five-author team went back to the ImageNet labels themselves. They set out to “develop a significantly more robust procedure for collecting human annotations of the ImageNet validation set”, then reassessed recent classifiers with the new labels and “find their gains to be substantially smaller than those reported on the original labels”. The second finding is the structural one, and it is not about any model. The original labels were no longer the best predictors of the independently collected set. A label scheme can stop being the thing worth predicting, and no backbone notices.

An incoherent taxonomy cannot be repaired by a more accurate backbone.

Analogy

A librarian sorting books from their covers

A librarian assigns shelf categories using only cover images. Clear genre cues help. Editions, decorative styles, and misleading artwork create systematic mistakes.

A librarian knows what the catalog is for. A classifier can exploit imperceptible correlations and does not understand the catalog's purpose. A metal token in the corner of a radiograph is exactly that kind of cue: available, predictive, and not the thing anyone meant to measure. The case turns on evidence limits and taxonomy design.

The label must be inferable from the visual evidence supplied to the model.

Key idea

Top-1 accuracy can conceal an unusable classifier

Accuracy weights every example equally and ignores the consequences of different mistakes. It can also look strong when one frequent class dominates.

Three commercial gender classifiers were measured on a gender- and skin-type-balanced benchmark in 2018. Buolamwini and Gebru state the result in two sentences: “We evaluate 3 commercial gender classification systems using our dataset and show that darker-skinned females are the most misclassified group (with error rates of up to 34.7%). The maximum error rate for lighter-skinned males is 0.8%.” That is a 33.9-point intersectional gap inside one product. No aggregate figure reports it — least of all one computed on IJB-A and Adience, whose lighter-skinned composition the same abstract gives as 79.6% and 86.2%.

NIST found the same shape at regulator scale in December 2019, in its report on demographic effects in face recognition. It evaluated 189 algorithms from 99 developers on 18.27 million images of 8.49 million people. One-to-one false-positive differentials “often ranged from a factor of 10 to 100 times, depending on the individual algorithm”. Three products and 189 algorithms give the same answer. The disparity is a property of the system that the average is built to erase.

Inspect per-class recall, confusion structure, calibration, abstention, subgroup slices, and performance under capture shifts. Choose metrics only after defining the decision policy.

A classifier is useful when its errors and uncertainty fit the workflow, not when one average is high.

Steps

Stress-test a classifier for shortcuts

Use interventions that alter suspected context while preserving the intended object or attribute. A clinical classifier was put through exactly that test in JAMA Dermatology in August 2019, by Winkler and colleagues.

The edit was one variable on 130 melanocytic lesions: the same lesions imaged with and without standard surgical ink markings. On benign nevi the mean melanoma probability rose from 0.16 (95% CI 0.10-0.22) to 0.54 (P < .001). Specificity fell from 84.1% (95% CI 76.0%-89.8%) to 45.8% (95% CI 36.7%-55.2%). The Key Points box states it plainly: “Skin markings by standard surgical ink markers were associated with a significant reduction in the specificity of a convolutional neural network by increasing the melanoma probability scores, consequently increasing the false-positive rate of benign nevi by approximately 40%.”

The repair step is measured too. Cropping the marking out of the frame restored specificity to 97.2% (95% CI 92.1%-99.0%) and brought the mean score down to 0.03. A counterfactual edit that breaks a model, and reversed, fixes it, is the strongest evidence available about what the model is using. Stronger than any saliency picture over the same lesion.

An independent group at the Medical University of Vienna ran the test in the other direction. They inserted artefacts such as skin markings and rulers into HAM10000 images, and measured AUPRC losses of 0.030 for ResNet-34, 0.045 for Faster R-CNN and 0.011 for Mask R-CNN. The size of the shortcut depends on the architecture. So the intervention has to be run against the model you are actually shipping.

FigureProcess · 5 steps
  1. 1. Form a shortcut hypothesis

    Name background, border, device, watermark, or acquisition cues that correlate with labels.

  2. 2. Build counterfactual edits

    Mask, replace, crop, or randomize the suspected cue while retaining target evidence.

  3. 3. Compare controlled slices

    Evaluate matched examples across sites, devices, backgrounds, and object scales.

  4. 4. Inspect local evidence

    Use occlusion and saliency tools as hypotheses, not proof.

  5. 5. Retrain and retest

    Change data or objective, then repeat the intervention on independent cases.

Confidence needs an event and a population

A 0.9 score is meaningful only after specifying the class event, model version, input population, and calibration procedure. Scores can become miscalibrated after shift or threshold changes.

Calibration should be evaluated on held-out data and on relevant slices. Temperature scaling or another post-processing method may help, but it cannot fix missing classes or unsupported evidence.

The problem was named at ICML in 2017, by Guo and three colleagues: “We discover that modern neural networks, unlike those from a decade ago, are poorly calibrated.” They report that “depth, width, weight decay, and Batch Normalization are important factors influencing calibration” — none of which is a knob anyone turns in order to fix confidence. On most datasets “temperature scaling”, which they describe as “a single-parameter variant of Platt Scaling”, is “surprisingly effective at calibrating predictions”. One parameter was enough on most of the datasets they tried. That says the miscalibration was systematic rather than buried deep in the network.

Then the finding moved. Minderer and seven co-authors re-ran the question on newer image classifiers in 2021. They found the most recent models, notably those not using convolutions, among the best calibrated. The previous generation's trends — calibration decaying with model size, and under distribution shift — were less pronounced in recent architectures. A statement about how confident networks are was true of the networks that were measured, and stopped being true four years later. This lesson's own claim, that confidence is conditional on a model version, is demonstrated by the calibration literature reversing itself rather than asserted at you.

Calibration aligns confidence with observed frequency under conditions; it does not create knowledge.

Example

What to inspect before approving a classifier

Any model review should connect taxonomy, evidence, metrics, and operations. Each item below has a number attached to it somewhere in this lesson, which is the standard to hold a review to.

  • Class definitions, exclusions, ambiguous cases, and examples requiring nonvisual context — including whether an explicit insufficient-quality output exists, as it does in the three-valued output the FDA authorised for IDx-DR under DEN180001.
  • Grouped or temporal split design, duplicate detection, and at least one site or source held out entirely: the pooled MSH and NIH pneumonia model scored AUC 0.931 internally and 0.815 at Indiana University.
  • Simple baselines and pretrained-transfer comparisons, plus the site-identification baseline itself — a model that names the source hospital for 99.95% of NIH images has told you the source is available to every other classifier trained on that data.
  • Per-class, slice, calibration, and abstention results: a 34.7% versus 0.8% subgroup spread inside one commercial product is invisible in every average anyone computes over it.
  • Counterfactual tests for background, border, device, and watermark cues, with effect sizes recorded — surgical ink markings moved specificity from 84.1% to 45.8% across 130 lesions, and cropping them out returned it to 97.2%.
  • Decision thresholds, review capacity, monitoring plan, and rollback criteria, including the disease rate inside the abstained bucket: 26% against 23.8% in the IDx-DR trial means the reject path needs a real downstream process, not an inbox.

Position

An accuracy number describes a label set as much as a model

An accuracy figure is read as a fact about the model. The label set it was scored against is treated as fixed, a neutral yardstick the model is measured on. That is the wrong way round more often than a benchmark table admits.

Start with the labels. The annotation procedure for the ImageNet validation set was rebuilt in 2020, and recent classifiers were rescored against the new labels. The gains shrank. The second result is the one to keep: the authors “find the original ImageNet labels to no longer be the best predictors of this independently-collected set”. A stronger backbone does nothing about that, and this lesson has already said why. An incoherent taxonomy cannot be repaired by a more accurate backbone.

The same defect shows up in how the test set was assembled, and it is measurable. In 2019 Recht and three colleagues built new test sets for CIFAR-10 and ImageNet, following the original collection procedures as closely as they could. Accuracy fell by 3%-15% on CIFAR-10 and 11%-14% on ImageNet. Models that had never been trained on those particular images simply scored lower on a set built the same way.

Then the correction was itself corrected. A 2020 paper showed that standard dataset-replication procedure introduces statistical bias, and reported: “We show that after remeasuring selection frequencies and correcting for statistical bias, only an estimated 3.6% of the original 11.7% accuracy drop remains unaccounted for.” Two rounds of careful work, and most of a headline generalisation gap turned out to be a property of how images were selected.

The per-image number has the same defect on a smaller scale. Guo and colleagues found modern networks poorly calibrated where the networks of a decade earlier were not, with depth, width, weight decay and Batch Normalization all influencing calibration, and none of them a confidence knob. So a 0.9 is a number that fell out of architecture choices. It becomes a probability only once someone calibrates it on a population they can name. Minderer and seven co-authors then found the trend had weakened on newer architectures — which is not a rebuttal but the same point again. The number described the measured population and generation, not confidence as such.

The defensible sentence is longer than the one people say, and its length is the content. Not “this model is accurate”, but something carrying conditions. Under this taxonomy, on this test set built this way, on this population, at this threshold: these are the errors it makes, and this is what its scores mean. The short version is not a compressed form of that. It is a claim about a leaderboard, and a leaderboard can hold steady while the taxonomy under it stops matching the decision.

Two of these problems were cheap. Temperature scaling costs one parameter and fixed most of the calibration problem. Most of an 11.7% accuracy drop turned out to be selection bias once someone remeasured. Both are cheap because they are problems in the measurement apparatus. Nothing that small exists for a label scheme that has stopped describing the thing you need to decide.

Key takeaways