Diorysos

Computer vision for quality inspection: how manufacturers can start small

Lighting, labels and the cost of a missed defect matter more than the model. How to scope and run a first inspection project on one line.

Diorysos · · 8 min read

Short answer

Pick one product and one defect family with a clear cost of escape. Get the imaging right first: lighting, camera, lens and part positioning. Collect images of good and defective parts, label them with agreed rules, and measure the model on missed defects and false rejects separately. Send uncertain results to an inspector and use their decisions to improve the model.

Visual inspection is one of the most practical uses of AI in manufacturing. It is also easy to get wrong when a project starts with the model instead of the problem. This guide sets out a small, measurable first project that a quality team can run on one line.

Step 1: scope one problem

Choose a product and a defect family where:

  • The defect is visible, at least to a trained inspector under good light.
  • Escapes are costly: customer complaints, rework, scrap or safety exposure.
  • Production volume is high enough to collect examples in weeks, not months.
  • The inspection rule can be written down, including what is acceptable.

Scratches on a painted surface, missing components on an assembly, or porosity on a casting face are typical starting points. "Inspect everything on the line" is not.

Step 2: get the imaging right

Image quality limits everything that follows. A model cannot find a defect that the image does not show.

  • Lighting: often the most important choice. Diffuse light reduces glare on shiny parts, low-angle light reveals surface texture and scratches, and backlighting shows outlines and holes.
  • Resolution: the smallest defect you must catch should cover several pixels in the image. Work this out from the field of view and the camera sensor before buying hardware.
  • Positioning: parts should arrive in a consistent position and orientation, or the system needs a step to locate them first.
  • Triggering: images must be captured at the right moment, usually from a sensor or the PLC.
  • Enclosure: ambient light changes during the day. Shielding the inspection area keeps conditions stable.

Run a short imaging trial with sample parts, including known defects, before committing to a setup.

Step 3: collect and label

Capture images from normal production, not only from a curated set. Include the full range of good parts, since normal variation in color, texture and position is what causes false rejects.

Labeling needs rules. Write a short guide with example images of each defect type and of acceptable variation. Then check that your inspectors agree with each other on a sample. If experienced people disagree on a part, the model will too, and the inspection rule needs clarifying before any training.

Step 4: choose the modeling approach

ApproachHow it worksSuits
Anomaly detectionLearns what good parts look like and flags anything differentRare defects, few defect images, many possible defect types
ClassificationAssigns a whole image to a class such as good, scratch or dentA small number of known defect types with enough examples
Object detection or segmentationLocates each defect in the image, with position and sizeWhen defect size or location decides accept or reject

Many projects start with anomaly detection because good parts are plentiful, then add classification or detection once enough defect examples have been collected.

Step 5: measure what matters on the line

Overall accuracy is misleading when defects are rare. Measure two errors separately:

  • Escapes (false accepts): defective parts the system passed. Usually the most costly error.
  • False rejects: good parts the system flagged. These cost re-inspection time and erode trust.

The model's decision threshold trades one against the other. Agree with quality and production where to set it, based on the cost of each error, before deployment. Test on images the model has never seen, ideally from different days and shifts.

Step 6: keep people in the loop

Most systems produce a confidence score. Use it to split results into three groups: clear passes, clear fails, and uncertain cases sent to an inspector. The inspector's decision is recorded and becomes new training data. This keeps quality decisions with people where the model is unsure, and improves the model over time.

A system that sends a manageable share of parts to review and catches defects reliably is more valuable than one that claims full automation and quietly lets parts through.

Step 7: deploy and watch for drift

Inspection models usually run on an industrial PC or edge device near the line, so decisions are made in time to divert parts. Plan for:

  • Integration with the PLC for rejects and with MES or quality systems for records.
  • Storage of images for flagged and reviewed parts, for traceability and retraining.
  • Monitoring of reject rates and confidence scores. A sudden change often means lighting, material or a camera has changed, not the parts.
  • A retraining process when products, suppliers or materials change.

After the first line

Once one inspection point runs reliably, the same pipeline of imaging, labeling, review and retraining can be repeated for other defects and lines. The second project is faster because the team has learned what good images and good labels look like on its own products.

Questions

How many images are needed to train an inspection model?

It depends on how varied your parts and defects are. Start with the images you can collect in a few weeks of production, measure performance, and add examples where the model is weak.

Should we use anomaly detection or defect classification?

Anomaly detection learns what a good part looks like and needs few defect images. Classification can name the defect type but needs labeled examples of each. Many projects start with the first and add the second.

Can computer vision replace human inspectors?

On well-defined checks it can take over most routine inspection. People remain essential for uncertain cases, new defect types and decisions on borderline parts.

More guides

Have a case like this on your desk?

Answer a few questions about your work. Someone from the team reads them and writes back with a diagnosis and a first proposal. It takes about two minutes.

Start the conversation

Or call +213 791 98 51 35.

One note a month

A short letter on AI in your sector, written by the team. Nothing else, and you can leave at any time.