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.
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)
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
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.
| Geometry | Renders | Best for |
|---|---|---|
| Brightfield (direct) | Specular return bright | General surface, print, presence |
| Darkfield (low angle) | Only scatterers bright | Scratches, edges, engraving, particulate |
| Backlight | Silhouette only | Dimensional gauging, holes, burrs |
| Coaxial / on-axis | Flat, glare-free specular | Flat shiny surfaces, wafers, mirrors |
| Dome (diffuse) | Even, shadow-free | Curved specular parts, solder joints |
| Structured / laser line | Height profile | 3D deformation, coplanarity, volume |
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
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 )
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.