Introducing AI visual inspection: from lighting and labeling to line integration

Whether AI defect inspection succeeds usually depends less on the model than on lighting, data and integration with the line. Here are seven steps to a successful rollout.

Introducing AI visual inspection: from lighting and labeling to line integration
Illustrative photo

More and more factories want AI to take over manual visual inspection. A common story is that accuracy looks great in the lab, then misjudgments pile up once the system is on the line. The problem is rarely the model itself — it is what happens before and after it. These are the steps we recommend.

1. Define what a defect is

Work with your quality team to list the defect types and the acceptable size and severity, and prepare reference samples. If inspectors do not agree with each other, the AI cannot learn a consistent standard either.

2. Lighting matters more than the model

Good lighting makes defects stand out on their own and makes the model's job much easier:

  • Backlight: for outlines, holes and defects that let light through.
  • Coaxial light: for scratches and dents on reflective surfaces.
  • Low-angle ring light: highlights surface relief, engraving and fine scratches.

Shield the setup from ambient light and choose the right camera resolution, lens and shutter speed so images stay sharp while parts are moving.

3. Collect and label data

Defective parts are usually far rarer than good ones, so imbalanced data is normal. Keep collecting samples of each defect type, label them consistently, and set aside part of the data for validation only.

4. Choose the right model type

TaskWhat it doesWhen to use it
ClassificationJudges the whole image OK / NGObvious defects, no location needed
Object detection (e.g. YOLO)Draws boxes around defects with their classYou need defect location and count
SegmentationOutlines the exact defect shapeYou need to measure defect area

5. Use the right metrics

Production lines usually care most about the escape rate (defective parts passed as good) and the false reject rate (good parts rejected). The two pull against each other, so set the decision threshold together with quality control instead of looking at a single accuracy figure.

6. Deploy at the edge

For real-time response and to keep data on site, models usually run on an edge computing device next to the line. Model compression and quantization (e.g. INT8) let you meet the line's cycle time with limited computing power.

7. Integrate with the line and keep improving

  • Trigger image capture with a sensor or PLC signal so every part is imaged in the same position.
  • Send the result as a DO signal to the PLC or reject mechanism.
  • Store NG images and decisions for traceability and retraining.
  • Review misjudged cases regularly and keep extending the dataset.
Is your line a good fit? Send us a few photos of good and defective parts and we will give you an initial feasibility assessment. Contact us

Written by the Balin R&D team as general technical guidance. Always check your specific product requirements and the latest regulations. Related service: AI Vision

Ready to start your project?

Tell our engineers what you want to build and get a free proposal covering everything from concept to mass production.