Company Logo

Machine Vision for Defect Detection: From Rule-Based to Neural — When to Use What

Not every inspection task needs deep learning. A practical breakdown of when classical computer vision outperforms AI, and when neural networks are worth the complexity.

Machine Vision for Defect Detection: From Rule-Based to Neural — When to Use What
Vision AI-Jan 1, 2026
Share

We build vision inspection systems through our IVQ platform. And the first thing we tell clients might surprise them: you probably don't need AI for half your inspection tasks. Classical computer vision — the kind that's been around for decades — is faster, cheaper, and more reliable for a lot of defect detection work. The trick is knowing where the line is.

Two kinds of defects

Think of manufacturing defects on a spectrum. On one end: is this component present? Is it the right orientation? Is the hole 3mm? These are deterministic — the answer is binary, the definition is geometric. Classical vision eats these for breakfast.

On the other end: is this surface scratch acceptable? Is this solder joint quality good enough? Is the paint finish uniform? These are subjective, variable, and maddeningly hard to define with rules.

Most real inspection systems need to handle both. Our approach: use the right tool for each part of the problem.

When rules beat neural networks

We built a PCB inspection system that checks 47 components per board — presence, position, orientation. Classical pipeline: capture image, correct perspective, template match each region, compare against golden reference.

Runs on a $50 embedded processor. Processes a board in 80ms. Zero false positives, because the rules are exact — a resistor is either there or it isn't.

A neural network approach would need 5,000+ labeled training images, a GPU, and would still occasionally flag a board as defective because a shadow fell differently. For this kind of check, AI is the wrong tool.

When you actually need deep learning

Surface inspection on machined aluminum. The acceptable finish has natural variation — grain direction, micro-texture, reflectivity. Defects (tool marks, burrs, pitting) also vary in appearance. We tried writing rules for this once. After three weeks and 400+ hand-tuned thresholds, we had an 85% detection rate and a 12% false positive rate. Not good enough.

Switched to a CNN trained on 1,200 labeled images. EfficientNet-Lite, quantized to INT8 for edge inference. Detection rate: 97%. False positive rate: 1.8%. And it took a week instead of three.

The model learned something we couldn't write rules for: the subtle boundary between "this is normal grain variation" and "this is a defect." That's where neural networks earn their keep.

The hybrid approach we actually ship

Our production systems are hybrid. Classical pre-processing handles the predictable stuff: image acquisition, lighting normalization, ROI extraction, and all the deterministic geometric checks. Only the ambiguous bits — surface quality, solder joint grading, cosmetic assessment — get sent to the neural network.

The neural network sees smaller image crops (faster inference), the classical checks act as a guardrail (catching obvious defects even if the AI has a bad day), and the whole system is more explainable — you can trace exactly which stage flagged what.

But here's the real secret: lighting. A well-designed lighting setup — dome lights for diffuse illumination, dark-field for surface defects, backlight for dimensional measurement — can eliminate the need for AI entirely in many cases. We always design lighting before we choose algorithms. It's the highest-leverage investment in any vision system.


Key Takeaways

  • Classical vision for geometric checks — faster, cheaper, zero false positives
  • Neural networks for subjective, variable defects where rules can't capture the boundary
  • Hybrid pipelines outperform either approach alone. We ship this on every project.
  • Lighting design is the highest-leverage investment. Get it right and everything downstream gets easier.
Machine Vision for Defect Detection: From Rule-Based to Neural — When to Use What | Insights | RND Square | RND Square