← All writing
Evaluation · 5 min read · 18 Nov 2026

Computer Vision in Production: Why Accuracy Diverges

The number on your evaluation slide and the number your users experience are rarely the same figure. Here is why, and what to do about it.

Cover image for the article: Computer Vision in Production: Why Accuracy Diverges

The slide says 97%, the ticket queue says otherwise

Every computer vision project I have looked at closely has had the same awkward moment. The model hits a headline number, 96 or 97 percent accuracy, on a held-out test set. Everyone is pleased. It ships. Three weeks later the support queue fills with complaints about misclassified items, and someone asks, quite reasonably, how a model this good can be failing this often. The honest answer is usually that the demo number and the production number were never measuring the same thing.

This is not a story about bad engineers or sloppy science. It happens to careful teams because the test set used to report accuracy is almost always a cleaner, narrower, more cooperative sample of the world than the one the model meets after deployment. The divergence is not a mystery once you decompose where it comes from, and it is largely predictable in advance if you are willing to interrogate your evaluation setup rather than trust the final number on its own.

I want to work through this with a concrete example rather than abstractions, because the gap between 97 percent and whatever the real figure turns out to be is usually explainable by two or three specific mechanisms, each of which leaves a trace if you know where to look.

Where the gap actually comes from

Take a defect detection model trained on photographs of components taken under consistent studio lighting, with the object centred, in focus, against a plain background. Suppose it scores 97 percent on a test split drawn from the same photography session as the training data. The first problem is leakage through correlated capture conditions: if the same batch of components, the same lighting rig, and the same camera produced both the training and test images, the model may have learned to recognise the lighting and background as much as the defect itself. The test set is independent in the statistical sense used during training, but it is not independent in the sense that matters, which is whether it represents a genuinely different sampling of the real deployment environment.

Second, consider the deployment camera. In production, images arrive from a handheld device or a fixed camera on a factory line, with variable lighting, motion blur, partial occlusion, and objects off-centre or at odd angles. None of that variation existed in the curated training set. A model that was 97 percent accurate on clean, centred, well-lit images might realistically fall to somewhere in the 70s or lower on this harder, more representative distribution, not because the model got worse, but because the test conditions it was actually measured against never resembled the conditions it now faces.

Third, there is the question of class balance. A demo test set is often built to have a tidy, roughly even split between defect and non-defect examples, say 50/50, because that makes the reported accuracy legible and the confusion matrix easy to read. In production, maybe 2 percent of items are actually defective. A model with a 70 percent true positive rate and a 95 percent true negative rate looks reasonable on the balanced test set, but on the real distribution it will flag roughly 5 percent of 98 good items as false positives, which is about four and a half false alarms for every genuine defect caught. That ratio can make a system operationally useless even though the underlying detection rate did not change. The accuracy number never moved; its meaning did.

factory assembly line camera inspection

Why this is a measurement design problem, not a modelling one

The temptation is to treat this as a model capacity issue and reach for a bigger network or more augmentation. Sometimes that helps, but the more fundamental problem is that the evaluation was never designed to predict production performance, so no amount of retraining against the same flawed test set will close the gap. If your test images come from the same acquisition pipeline, the same time window, or the same set of source objects as your training images, you have built a test set that measures memorisation of conditions rather than generalisation to new instances. This is a leakage problem, and leakage inflates accuracy in a way that looks exactly like genuine skill until the model meets something new.

The fix starts with asking what the true deployment distribution looks like and deliberately sampling your evaluation data to match it, even when that is inconvenient. That means holding out entire capture sessions, entire devices, or entire time periods rather than randomly shuffled individual images, so that the split respects the boundaries along which real-world variation actually occurs. It also means collecting a small amount of genuinely messy, in-the-wild data before launch, even if it is expensive or slow to gather, because that data is the only honest preview of what the shipped system will see.

It is also worth separating the question of raw accuracy from the question of operational cost. A confusion matrix built on realistic class frequencies, with an explicit cost attached to false positives and false negatives, tells you far more about whether the system is usable than a single accuracy figure ever will. In the defect example above, reporting the expected number of false alarms per shift is more actionable than reporting accuracy, because it directly answers the question an operations manager actually has.

None of this requires exotic techniques. It requires treating the test set with the same scepticism you would apply to a dataset someone else handed you, checking for leakage across capture sessions, matching class frequencies to reality, and stress-testing against the kind of noisy, off-angle, badly lit input the model will actually receive. The gap between demo accuracy and shipped accuracy is not inevitable, it is a symptom of an evaluation that answered a different, easier question than the one the business actually needed answered. Build the harder, less flattering test set first, and the shipped number stops being a surprise.

← All writing See the project case studies →