Computer vision inspection works when the physical setup is right first: fixed cameras, controlled lighting and parts presented the same way every time. Then you need examples of good parts and real defects, a model suited to how rare the defects are, and a test on the live line against human inspectors. Most of the work is in the setup, the data and the running, not the model.
On many production lines, quality inspection still means a person looking at parts as they pass. People are good at it for the first hour and less good by the eighth. Computer vision promises to check every part, every shift, the same way. It can, but only if the project is set up the right way round.
This post walks through what it actually takes, from the camera to the first month on the line.


1. Get the physical setup right first
The model can only judge what the camera can see. Before any AI:
- Fix the camera. Same position, same angle, same distance for every part.
- Control the light. Factory lighting changes through the day. Enclosures and dedicated lights make results repeatable. The type of light matters too: angled light shows scratches and dents; backlight shows outlines and holes.
- Present the part the same way. Jigs, guides or a trigger sensor so the part is in the same place in every image.
- Match the line speed. Exposure time and processing time must keep up with how fast parts move.
A good setup can make a defect obvious. A bad one can hide it from any model.
2. Collect the right data
You need images of good parts, and images of real defects with their types marked. In practice, real defects are rare, which is a good thing for the factory and a problem for training.
There are two common answers:
- Anomaly detection. The model learns what a normal part looks like and flags anything unusual. It can start with mostly good parts. Public benchmarks such as the MVTec AD dataset, with over five thousand images across fifteen kinds of objects and textures, were built to compare these methods.
- Defect classification and detection. The model learns each named defect type and where it sits in the image. This needs labelled examples of each type, but tells the operator what went wrong.
Many systems combine both: anomaly detection to catch anything odd, classification for the defects you know well.
3. Choose where the model runs
A camera on a fast line usually needs an answer in milliseconds, so inspection models often run on a computer next to the line rather than in the cloud. That also keeps production images inside the factory. The cloud is still useful for training, storing images and dashboards.

4. Test on the live line, against people
Lab accuracy is not line accuracy. Run the system alongside your inspectors for a few weeks without letting it reject anything. Compare:
- defects both caught,
- defects only the system caught,
- defects only people caught,
- good parts the system wrongly flagged.
The last two matter most. Missed defects reach customers. False alarms slow the line and teach operators to ignore the system. Agree in advance how many of each you can accept.
5. Connect it to the line
Decide what happens when a part is flagged: a reject arm, a light, a stop, or a log for review. Link the result to the line controller and to your quality records, so every flagged part has an image attached.
6. Keep it accurate
Things change: new suppliers, new batches, a camera knocked out of place, a new defect nobody has seen. Plan for:
- Monitoring the reject rate and false alarms every day.
- A review queue where inspectors confirm or overrule flagged parts. Their decisions become new training data.
- Regular retraining and re-testing before each new version goes live.
What to ask before you start
- Which defects cost you most today, and how often do they happen?
- Can the part be presented the same way every time?
- How fast is the line, and what should happen to a flagged part?
- Who will review flagged parts and label new defects?
If you can answer those four, a vision inspection project has a good chance of working. Our post on testing an AI system before it goes live covers the testing side in more depth.
Questions people ask
Can AI find defects that are rare?
Yes. When real defects are rare, anomaly detection models learn what a good part looks like and flag anything that differs. Public benchmarks such as MVTec AD were built to test exactly this.
Do I need special cameras?
Often industrial cameras and, just as important, controlled lighting. The right lens, angle and light can make a defect obvious or invisible before any AI is involved.
How many images are needed?
It depends on the part and the defects. Anomaly detection can start with mostly good parts. Classifying specific defect types needs labelled examples of each one. Plan to keep collecting images after launch.
Will it replace human inspectors?
Usually it changes their job. The system checks every part, and inspectors review what it flags, handle borderline cases and help label new defect types.


