Defect DetectionEngineering guide10 min read

Rules-Based Vision vs AI Defect Detection: Use the Simplest Tool That Holds Up

Deep learning is genuinely useful for appearance defects nobody can specify. It is also the most expensive way to solve a measurement problem you could have solved with a threshold.

By VisionAxiom EngineeringReviewed by VisionAxiom Systems EngineeringPublished 2026-09-03
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

Sort the defect, then choose the tool

The useful split is not "traditional vs AI". It is whether the defect can be specified as a measurement on a repeatable image. If it can, deterministic vision will be faster, cheaper to validate, and far easier to explain to an auditor or a maintenance technician at 2 a.m.

Measurable defect
Missing component, dimension out of tolerance, cap height, label skew, code content, hole, gross contrast anomaly. Deterministic tools.
Appearance variation
Scuffs on textured surfaces, natural-material grain, weld or coating cosmetics, subtle staining, defect classes nobody can fully enumerate. Learned models earn their place.
Ambiguous by nature
Defects human inspectors disagree about. Neither approach saves you: the specification must be settled first.

What deterministic vision does well

  • Repeatable, explainable decisions: the same image yields the same verdict, and the reason is inspectable.
  • Fast validation: change a threshold, re-run the panel, document the result.
  • Low data requirement: a handful of representative samples, not thousands of labeled images.
  • Predictable runtime, which matters when the decision has to land inside a reject window.
  • Straightforward change control: parameters are a short, reviewable list.

What learned models do well — and what they cost

A trained model can separate acceptable from unacceptable appearance when the boundary is defined by examples rather than by rules. That is a real capability, and on textured or naturally variable product it is sometimes the only capability that works.

The cost is not compute. It is the data and lifecycle burden.

  • Labeled examples covering each defect class and, critically, the full range of acceptable variation.
  • Marginal samples — the near-misses — which are the hardest to collect and the most valuable.
  • A labeling standard and a resolution process for disagreements between labelers.
  • Held-out evaluation data that never entered training, or your reported performance is meaningless.
  • Re-validation whenever the substrate, supplier, lighting or fixturing changes, because the model's world changed.
  • Version control: model artifact, training set snapshot, evaluation results and the recipe that references them.

The hybrid architecture is usually the honest answer

In practice the strongest inspection systems use deterministic tools for what is deterministic and confine the learned component to the narrow question that resists rules.

  • Localization deterministic: the region of interest is found by geometry, not inferred.
  • Hard specifications stay as rules so they cannot be softened by a retrain.
  • The model decides one bounded question, which makes its evaluation tractable.
  • Low-confidence outputs routed to a defined behavior — reject, flag, or operator review — rather than silently guessed.

Hybrid inspection pipeline

01Trigger + strobed image
02Deterministic locate / align
03Rule checks (presence, dimension, code)
04Candidate region extraction
05Learned classification (only where needed)
06Verdict + confidence
07PLC reject
08Image + label retained
Deterministic localization keeps the pipeline stable and auditable; classification is the only stage carrying model risk.

False rejects are the real project risk

Escapes get the attention; false rejects get the system turned off. A station that rejects good product will be widened, bypassed or ignored within weeks, and then the plant has an expensive ornament.

Both directions must be budgeted and reported separately. A single blended accuracy figure hides the tradeoff that every threshold and every retrain moves.

  • Escape and false-reject budgets agreed in writing before acceptance.
  • Threshold margin measured — how far is the operating point from the nearest good sample?
  • Nuisance variation catalogued: shadows, condensation, dust, part-to-part color drift.
  • Ongoing monitoring of reject rate by reason code so drift shows up as a trend, not as a shift-floor argument.

Validation burden, compared honestly

Deterministic
Panel run at speed; parameter list reviewed; re-run after mechanical or lighting change. Days.
Learned model
Held-out evaluation plus at-speed panel run; labeling standard documented; retrain triggers defined; artifact and dataset versioned. Longer, and recurring.
Regulated environments
Learned components need a change-control story: what triggers retraining, who approves, how the prior version is retained and rolled back.

When an off-the-shelf tool is the better choice

Modern smart cameras and vision sensors, including the deep-learning tools in Cognex and KEYENCE platforms, are good products. For a single defect class, one view, a stable presentation and no traceability requirement, they are frequently the correct answer and we will say so.

A configured system becomes the right architecture when multiple views and checks must be coordinated, when the decision must integrate with PLC reject logic and per-order recipes, when image and verdict records must be retained, or when a hybrid deterministic-plus-model pipeline needs to be maintained and re-validated over time.

Frequently asked questions

How many images do we need to train a defect model?
It depends on how variable the acceptable product is, not on a fixed number. The practical answer comes from a feasibility set: collect real samples, evaluate on held-out data, and see where the curve flattens.
Can we start with rules and add AI later?
Yes, and that is often the right sequence — provided the imaging is good enough for both and the images are retained from day one so a training set can be built from production reality.
Where does inference run?
Wherever the timing budget and maintenance model allow — an industrial PC at the station or an embedded accelerator. It is a system decision constrained by the reject window, not a preference.

Related systems & engineering resources

Next step

Have an inspection problem in front of you?

Send the part, the line speed and the defect you need caught. We respond with an engineering assessment, not a brochure.