All insights

AI

Computer Vision in Manufacturing QA: Lessons From 30 Production Deployments

Defect detection systems fail in ways traditional QA does not. We share what we learned about lighting, dataset drift, edge inference, and operator buy-in across thirty deployments.

Root Digit Engineering · Computer Vision Lead7 min read

The most consequential decisions in a machine vision inspection system are made before any model exists. If the defect is not physically resolved by the optics, or if the lighting does not create contrast between defective and acceptable material, no architecture recovers it. A large share of the vision projects we are asked to rescue are imaging problems being treated as modelling problems.

Resolution: the constraint that is arithmetic, not judgement

A feature must span enough pixels to be distinguishable from sensor noise and demosaicing artefacts. Detection needs a minimum of roughly three pixels across the smallest dimension of the defect; dimensional measurement to a stated tolerance needs considerably more.

pdefect  =  dmin  ×  Npx  /  FOV    ≥    3  (detect)   |   10  (measure)

d_min — smallest defect to be caught · N_px — sensor pixels across that axis · FOV — field of view in the same units. A 0.2 mm defect across a 300 mm field on a 4096 px line needs 0.2 × 4096 / 300 ≈ 2.7 px — below the detection floor before anything else is considered.

When the arithmetic fails, the options are a larger sensor, a narrower field with more cameras, or a different sensing modality. They are not more training data. This calculation belongs in the first hour of the project, and doing it there is the single highest-return habit in industrial vision.

Motion introduces a second constraint that is equally hard. Any exposure taken while the part is moving smears the image, and once the smear exceeds a pixel it has destroyed the resolution the first calculation just established.

b  =  v  ×  texp  ×  ( Npx / FOV )   <   1 px

At 1.5 m/s with a 13.6 px/mm scale, exposure must stay under about 49 µs to hold blur below one pixel — which in turn dictates illumination intensity, and usually means strobed rather than continuous lighting.

Lighting creates the signal. Everything else only processes it.

Contrast between a defect and its surroundings is produced by the interaction of illumination geometry with surface physics. The right geometry can render a defect obvious to a threshold; the wrong one can make it invisible to any model, and no amount of capacity compensates for information that was never captured.

GeometryRendersBest for
Brightfield (direct)Specular return brightGeneral surface, print, presence
Darkfield (low angle)Only scatterers brightScratches, edges, engraving, particulate
BacklightSilhouette onlyDimensional gauging, holes, burrs
Coaxial / on-axisFlat, glare-free specularFlat shiny surfaces, wafers, mirrors
Dome (diffuse)Even, shadow-freeCurved specular parts, solder joints
Structured / laser lineHeight profile3D deformation, coplanarity, volume
Illumination geometry by defect class. Selection is driven by how the surface scatters — a technique that works on machined aluminium may fail entirely on the same part after anodising.

For dimensional measurement specifically, telecentric optics are not a refinement but a requirement. A conventional lens magnifies nearer objects more, so a part's apparent size depends on its distance from the camera — meaning a measurement varies with how the part happens to sit in the fixture. A telecentric lens holds magnification constant across its working depth, removing that error term entirely.

Modelling under extreme class imbalance

A mature production line has a defect rate measured in parts per million. Supervised classification wants balanced classes and thousands of examples per class; the process will not supply them, and waiting for it to do so means waiting for failures the customer is paying to prevent.

The reframing that works is one-class: model what normal looks like and flag departures from it. Patch-based methods that build a memory bank of normal local features and score by distance to the nearest neighbour are the current practical standard — they train on defect-free images only, need hundreds rather than tens of thousands, and localise the anomaly rather than merely scoring the image.

s(x)  =  maxi ∈ patches   minm ∈ M   ‖ fi(x) − m ‖2

f_i — feature embedding of patch i · M — coreset of embeddings from defect-free examples. The image score is the most anomalous patch, which is why this localises defects rather than only detecting them.

The practical benefit is deployment on a line that has produced no defects yet. As real escapes accumulate, they become a validation set — measuring whether the anomaly detector catches them — and eventually, for defect modes that recur often enough, a supervised classifier for those specific classes running alongside the one-class detector.

Prove the measurement system before trusting its output

Manufacturing quality has a discipline for this that the machine learning field largely rediscovers under other names. Measurement System Analysis asks how much of observed variation comes from the process and how much from the measurement, and an inspection system that has not passed it is not yet evidence about anything.

For pass/fail inspection the relevant study is attribute agreement analysis: repeated evaluation of known parts, assessing agreement of the system with itself, with human inspectors, and with ground truth — corrected for the agreement expected by chance.

κ  =  ( po − pe )  /  ( 1 − pe )

p_o — observed agreement · p_e — agreement expected by chance. At low defect prevalence raw agreement is misleadingly high; a system that passes everything scores 99.7% agreement and κ ≈ 0. Conventional acceptance is κ > 0.9.

The two figures that go in the acceptance criteria are escape rate — defective parts passed — and overkill rate — good parts rejected. Both must be stated, because they trade against each other along the decision threshold, and a specification that names only one is a specification that will be met by moving the threshold to the other extreme.

What changes after go-live

The imaging conditions the system was validated under will drift. Lamps age and shift in output and colour temperature. Lenses collect coolant mist. Cameras move fractionally when fixtures are serviced. New material lots arrive with different surface finish. Each of these shifts the input distribution while the model stays fixed.

The countermeasure is a physical reference in the field of view — a calibration target imaged periodically, with intensity, contrast and sharpness trended. When those metrics drift beyond limits the system raises a maintenance request rather than continuing to make decisions on degraded images. This is the difference between an inspection system that is trusted in year three and one that has quietly been switched to advisory mode because nobody could explain why the reject rate climbed.

Explore how Root Digit can support your team

From discovery workshops to production deployment, our engineers and consultants partner with you across the lifecycle of your AI, robotics, and IoT initiatives.

Cookie Policy

We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies. You can also choose "Necessary Only" to limit cookies to essential website functions only. Learn more