Applying Machine Learning in Computer Vision Systems

Why off-the-shelf CV models fail in production: edge cases that break them, testing before deployment, cost of late discovery, fine-tune vs replace.

Applying Machine Learning in Computer Vision Systems
Written by TechnoLynx Published on 14 May 2025

Introduction

Applying machine learning in computer vision systems is most often described as model selection — pick the best architecture, fine-tune, deploy. The recurring production failure is different: teams pick an off-the-shelf model, deploy it without sufficient testing against representative production data, and discover its limitations only after the system is in front of users or operators. The cost of that late discovery is what differentiates teams that ship CV systems from teams that ship CV demos. See computer vision for the broader landing this article serves.

The expert read is that production CV failure is a testing-and-validation discipline failure more often than a model-selection failure.

What this means in practice

  • Off-the-shelf models reflect their training distribution; production distributions differ.
  • Edge cases that break detection or classification are systematic, not random.
  • Test against representative production data before deployment, not after.
  • The fine-tune-vs-replace decision depends on whether the failure mode is data or class.

Why do off-the-shelf computer vision models fail in production?

The single biggest reason: training-data and deployment-data distributions differ. The model has learned the patterns in its training set; production presents inputs the training set under-represented. Distribution differences include lighting (training images mostly outdoor sunny; deployment includes indoor fluorescent, low-light, mixed), camera characteristics (training images from consumer phones; deployment from industrial cameras with different optics, sensors, colour balance), subject distribution (training images include common objects in typical poses; deployment includes domain-specific objects, unusual poses, occlusions), and resolution and framing (training crops centred on subject; deployment frames variable, subject off-centre or partial).

Secondary reasons. Training-label noise (the off-the-shelf model encodes the labelling errors of its training set, which the deploying team may not know about). Class definitions misaligned with deployment needs (the model’s “person” class includes mannequins; deployment needs to distinguish people from mannequins). Temporal expectations mismatch (model trained on single frames; deployment expects temporal consistency the model does not provide). Adversarial or rare conditions the training set never sampled (weather, occlusion, intentional adversarial input). The pattern is consistent: off-the-shelf models work where their training distribution matches deployment; they fail where it does not. The work is characterising the distribution mismatch before deploying.

What kinds of edge cases break public detection / classification models in real deployments?

Lighting and exposure. Severely back-lit subjects, deep shadows, mixed lighting, infrared / night-vision input on RGB-trained models. The model’s failure mode is often confidence collapse (low scores across all classes) or systematic mis-classification.

Viewpoint and pose. Subjects at unusual angles, partial views, extreme close-ups, very far subjects. Detection models trained on typical viewpoints often miss subjects outside the training viewpoint distribution.

Occlusion. Partial subject occlusion (a person behind a railing, an object behind another object). Detection thresholds tuned for clear views collapse on partial occlusion.

Crowding and density. Many overlapping subjects, especially of the same class (a dense crowd of people). Non-maximum suppression and detection limit settings designed for sparse scenes fail in dense scenes.

Domain-specific subjects. Industrial equipment, medical imaging, agricultural inputs, satellite imagery — anything outside the consumer-imagery distribution that most public models train on. The model often produces nonsense outputs because the subjects are out-of-distribution.

Visual similarity within or across classes. Subjects easy for humans to distinguish (different fish species, different fastener types) but visually similar at training resolution. The model defaults to majority-class predictions or low confidence.

Adversarial input. Intentional or unintentional adversarial patterns (stickers on stop signs, t-shirt patterns confusing person detection). Models trained without adversarial robustness are susceptible. The pattern across all edge cases: they are systematic and characterisable by the deployment team, not random. The deployment team that catalogues likely edge cases for the application catches most failures before deployment.

How do I test a CV model against production data before shipping it?

The disciplined process. Collect a representative sample of production data — not random, but stratified across the conditions the deployment will see (different lighting, different times of day, different cameras, different scenes, different subject types). The sample must be labelled with ground truth for the deployment task; this is engineering work that cannot be skipped.

Measure model performance on the labelled sample. Overall metrics (precision, recall, mAP, F1, accuracy depending on task) plus per-stratum metrics (performance on each lighting condition, each camera, each subject type). The per-stratum analysis reveals where the model is weak.

Construct adversarial and edge-case test sets. Curate sets of known difficulty cases (occlusion, unusual viewpoint, rare subject) and measure separately. The model’s behaviour on edge cases is more important than overall metrics because edge cases are where deployment problems occur.

Test under realistic operational conditions. Latency on target hardware with target input pipeline (not benchmark-isolated inference). Throughput under realistic load. Robustness to input variations the production pipeline produces (compression artefacts, scaling, colour-space conversion).

Document the failure cases that remain. The model that ships will have failure modes; documenting them lets the operations team build the right safeguards and the right escalation path. Testing reveals what cannot be fixed in time for deployment, which is information the deployment team needs.

What does it cost to discover an off-the-shelf model is wrong only after deployment?

Direct costs. False-positive cost: the operational cost of acting on incorrect AI output. In CCTV, false-positive alerts consume operator attention; in industrial inspection, false-positive rejects scrap good product; in medical, false-positives cause unnecessary follow-up. False-negative cost: the operational cost of missing what the AI should have detected. Often higher than false-positive cost depending on the application (missed security event, missed defect, missed disease).

Indirect costs. Loss of operator trust. Once operators learn the AI is unreliable, they discount its output even when it is correct, reducing the system’s value beyond the actual error rate. Re-engineering cost. Retrofit data collection, retraining, re-validation under deadline pressure costs multiples of pre-deployment validation. Compliance and audit cost. Devices that fail in production after clearance trigger regulatory and audit scrutiny. Reputational cost. Public AI failure becomes a case study cited against the entire programme.

The economic case for pre-deployment testing. Pre-deployment testing of a CV model on representative data and edge cases is typically weeks of engineering effort. Post-deployment discovery of model inadequacy is typically months of engineering effort plus operational costs plus reputational costs. The ratio is roughly 1:10 or worse in favour of pre-deployment testing. Teams that under-invest in pre-deployment testing pay the bill at deployment time.

When is fine-tuning enough versus replacing the model entirely?

Fine-tuning is enough when. The model architecture is appropriate for the task (right input modality, right output structure). The failure mode is data-distribution mismatch that can be addressed by adding deployment-representative data to training. Sufficient labelled deployment data exists or can be collected (typically hundreds to thousands of examples per class for fine-tuning). Performance gap between off-the-shelf and required is moderate (not order-of-magnitude). Fine-tuning is a common and effective fix; do not skip it for purely architectural alternatives if the architecture is fundamentally sound.

Fine-tuning is insufficient when. The model architecture is wrong for the task (single-frame model for a temporal task, classification model for a detection task, low-resolution model for a high-resolution task). The model class is fundamentally limited for the task (early detection architecture for a small-object task that requires multi-scale; classification model for a structured-output task). The deployment requires capabilities the model does not have (3D output, segmentation when the model does detection, multi-modal fusion when the model is single-modal). Required performance is order-of-magnitude beyond off-the-shelf and fine-tuning will not bridge.

The decision process. Diagnose the failure: is it data or architecture? If data — collect, label, fine-tune, re-validate. If architecture — research alternative architectures, evaluate, prototype, validate, and accept that this is a larger engineering investment. The cost is much different (fine-tuning weeks vs replacement months), so accurate diagnosis matters. Teams that default to one answer (fine-tune everything, or replace everything) waste effort in both directions.

Which object-detection problems are inherent to the model class versus solvable with more data?

Inherent (model-class) limitations. Resolution: a model trained at 640×640 will miss very small objects regardless of training data; multi-scale or higher-resolution architecture is required. Temporal: a single-frame model cannot resolve cases requiring multi-frame context (motion classification, partial occlusion resolved by tracking); a temporal model is required. Spatial reasoning: a 2D detector cannot infer 3D relationships, depth, or occlusion ordering; 3D-aware architecture is required. Long-tail class: a closed-vocabulary detector cannot detect classes it was not trained on; open-vocabulary or zero-shot architecture is required.

Solvable with more data. Within-distribution class confusion (model confuses sub-classes the training data does not adequately distinguish): more data with the specific sub-class examples plus label quality fixes the issue. Domain shift (training on one domain, deploying on another): more in-domain training data fixes the issue. Class imbalance (rare classes under-represented): more rare-class data or class-balanced sampling fixes the issue. Edge cases the training set under-sampled (specific lighting, viewpoint, occlusion patterns): more representative examples fix the issue.

The diagnostic question for any failure: would a human expert with no model knowledge be able to perform the task on this input? If yes, the issue is likely solvable with more representative training data. If no — the input is genuinely ambiguous or requires capabilities the model class does not have — the issue is inherent and replacement or augmentation is required. The discipline is to ask the diagnostic question before committing engineering investment in either direction.

Limitations that remained

CV systems have residual error rates that cannot be driven to zero; deployment requires accepting and operationalising the residual. Some edge cases are unpredictable until deployment surfaces them; the response is operational discipline (monitoring, escalation) not perfect pre-deployment testing. The fine-tune-vs-replace decision is judgement informed by diagnosis; teams that diagnose poorly waste effort regardless of which path they choose. Off-the-shelf models continue to improve, which can shift the fine-tune-vs-replace boundary year to year; the architecture decision is not permanent. Production CV is operational engineering as much as ML engineering; teams optimised for one and not the other ship systems that fail in the other dimension.

How TechnoLynx Can Help

TechnoLynx works on production CV deployments where the failure-pattern diagnosis matters — building the representative test sets, characterising the edge cases, and making the fine-tune-vs-replace decision before committing to one path. If your team is moving a CV system from prototype to production and wants the validation discipline that catches failures pre-deployment, contact us.

Image credits: Freepik

Back See Blogs
arrow icon