Application

Automated Defect Detection

Defect detection is a classification contract. Write the defect list first; the algorithm choice follows from it.

Author: VisionAxiom Applications EngineeringReviewed by: VisionAxiom Technical ReviewUpdated: 2026-09-02
Operator at a cap inspection station: monitor showing a grid of caps with green region-of-interest overlays over a roller conveyor
Cap inspection station — live ROI grid over the conveyor

Direct answer

How do you choose between rules-based and AI defect detection?

Use rules-based vision when a defect can be described with a measurable threshold — size, contrast, position, count, dimension. Use a learned model when the defect class is visually consistent to a human but cannot be expressed as a threshold, such as varied cosmetic blemishes on textured surfaces. Many production systems combine both: deterministic tooling for measurable checks and a model only for the ambiguous class.

Write the defect table before choosing tools

Defect class
Name, description, example images
Minimum size
Smallest instance that must be caught
Frequency
Occurrence rate — drives sample sizes for validation
Severity
Escape cost: cosmetic, functional, or regulatory
Detectability
Which lighting geometry makes it visible at all

Rules-based, learned, or both

  • Rules-based: deterministic, explainable, fast to validate, cheap to change; brittle when appearance varies.
  • Learned models: tolerant of appearance variation; need labeled data, a retraining plan, and version control tied to quality records.
  • Hybrid: locate and measure with rules, then hand only the ambiguous region to a model — usually the most maintainable arrangement.
  • Anomaly-style approaches can work when defects are rare and unpredictable but good product is highly consistent.
Grayscale inspection capture of a carton with red and green region-of-interest boxes around printed codes
Inspection capture — ROI boxes over print and 2D code regions

Escapes and false rejects are separate budgets

An escape reaches your customer. A false reject destroys good product and erodes operator trust until someone tapes over the sensor. Both must be quantified against a labeled panel at line speed, and the tuning target must be stated as a tradeoff, not a single accuracy number.

Training data, honestly

The question is never simply how many images. It is how many images per defect class, spanning the real variation in substrate, lighting drift, shift changes and SKUs. Small, well-curated, correctly labeled sets with genuine class coverage routinely beat large sets scraped from one good hour of production.

Frequently asked questions

How many images do I need to train a defect model?
It depends on how visually consistent the defect class is and how much nuisance variation the line produces. Plan for per-class coverage across substrates, shifts and SKUs, hold back a labeled test set that never influences training, and treat the first deployment as a data-collection phase rather than a final model.
Can a vision system find defects it has never seen?
Anomaly-based methods can flag deviation from a learned normal, which helps for unknown defects, but they typically produce more false positives and need a human disposition path.

Next step

Discuss your inspection problem with an engineer.

Send samples, line speed and the defect you cannot let through. We respond with an imaging assessment, not a brochure.