Skip to content

Computer vision quality inspection: where it pays in manufacturing

13 Nov 2026

·

6 minute read

Computer vision quality inspection uses cameras and trained models to find defects on a production line: scratches, dents, missing parts, misprinted labels, bad seals. It pays when three things are true. The defect is visible to a camera, the product and its position are consistent from one unit to the next, and a missed defect or the manual inspection it replaces is expensive. The first decision in any project is how to train the model, because most factories have thousands of photos of good parts and very few of defects. Anomaly detection, which learns only from good parts, is often the right starting point.

Where does computer vision pay off on a production line?

Inspection with a camera works best on problems a trained person could spot by looking:

  • Surface defects such as scratches, dents, stains and cracks
  • Missing, extra or misplaced components on an assembly
  • Print and label checks: wrong label, smudged code, misaligned text
  • Packaging checks such as seals, fill levels and closures

It works less well when the defect is inside the part, when the product's appearance varies naturally from unit to unit, or when the line cannot hold the part still and evenly lit for the camera. In those cases, fix the physical setup or choose a different sensor before choosing a model.

Do you need photos of defects to train a model?

There are two ways to train an inspection model, and the choice depends on the photos you have.

A supervised defect model learns from labelled examples of each defect type. It can tell you which defect it found, which helps with root-cause analysis, but it needs enough examples of every defect you care about, and it can miss a defect type it has never seen.

An anomaly detection model learns what a good part looks like and flags anything that differs. Researchers built a public benchmark around this case. The MVTec AD dataset is designed "for benchmarking anomaly detection methods with a focus on industrial inspection" and contains over 5,000 high-resolution images in fifteen object and texture categories, where each category's training set contains only defect-free images. One well-known method, PatchCore, needs "nominal (non-defective) example images only" and reported an image-level AUROC of up to 99.6% on that benchmark (Roth et al., 2021).

AUROC measures how well a model ranks defective parts above good ones across all possible thresholds. It is a useful way to compare methods, and it does not tell you how many defects your line will miss at the threshold you choose. Your parts, lighting and camera will differ from any benchmark, so treat published scores as a reason to try a method, and test it on your own images.

One more caution: MVTec AD is published under a non-commercial licence. Use it to learn and compare methods, and collect your own images for anything you deploy.

Your situationStart with
Thousands of good-part images, few or no defect imagesAnomaly detection trained on good parts
Plenty of labelled examples of each defect typeA supervised defect model
You need to know which defect type occurredSupervised, or anomaly detection plus a classifier on flagged images
New defect types appear oftenAnomaly detection, which does not need to have seen them

Get the camera setup right before the model

Most failed inspection pilots fail on the physical setup. Before training anything, make sure each part arrives in the same position, under the same lighting, at the same distance from the camera, and that the camera is triggered at the same moment. Shield the station from daylight and nearby lamps that change through the day. A model trained on images taken at noon will drift at night if the lighting changes with it.

Measure missed defects and false rejects separately

An inspection system makes two kinds of mistake. It can pass a defective part, which reaches the customer, or reject a good part, which wastes material and annoys the line. You cannot minimise both at once; the threshold trades one against the other.

Agree the trade-off with the quality and production teams before the pilot: how costly is a missed defect compared with a false reject? Then set the threshold to match. Many teams start by sending flagged parts to a person for review, which keeps the line moving while the model earns trust. Our note on designing the human approval step covers what that reviewer needs to see to decide quickly.

Run a pilot on one station first

A small pilot answers the questions a sales demo cannot:

  1. Pick one station with a clear, visible defect and a known cost when it is missed.
  2. Fix the camera, lighting and part position.
  3. Collect images of good parts, and every defect you can find, over normal production.
  4. Train the model and run it in shadow mode, flagging parts without stopping the line.
  5. Compare its flags with the human inspector's decisions for a few weeks.
  6. Decide on the threshold, the review step and whether to expand.

Frequently asked questions

How many defect images do I need for computer vision inspection?

With anomaly detection, you can start with images of good parts only. Methods such as PatchCore are designed for that case. You still need some real defect images to test the system before trusting it.

Can computer vision replace manual quality inspection?

It can take over repetitive checks, but most lines start with the model flagging parts for a person to review. Full replacement makes sense once the missed-defect and false-reject rates are measured on your own production.

What is AUROC in defect detection?

It is a score between 0 and 1 for how well a model ranks defective parts above good ones across all thresholds. It is useful for comparing methods on the same data, and it does not give the miss rate on your line.

Is the MVTec AD dataset free to use?

It is free for non-commercial use under a Creative Commons non-commercial licence. Commercial use of the dataset itself is not allowed.

Elroot Labs builds AI systems with evaluation and human review designed in from the start. If you are planning an inspection pilot, you can tell us about the line.

AI tools

Ask ChatGPTAsk Claude

Start with the problem that matters