Rule-based machine vision measures and compares: an engineer programs tools to find edges, count pixels or read a code, and sets tolerances. Deep learning vision learns the decision from labeled example images. Use rule-based vision for precise, repeatable measurements on consistent parts; use deep learning when defects are irregular, good parts vary naturally or the decision needs human-like judgment. Most production systems use both.
This article is part of our guide to industrial AI. It is the decision most AI vision projects start with, so we cover how each approach works, a side-by-side comparison, a checklist and the hybrid designs that win in practice. For the fundamentals of cameras, lighting and optics, see the machine vision guide.
Is machine vision AI?
Not necessarily. Machine vision is the system: camera, lenses, lighting, processor and software that inspect or measure parts. For decades that software was entirely rule-based, and much of it still is. AI, in the form of deep learning, is one kind of software that can run inside a machine vision system. So all AI vision inspection is machine vision, but not all machine vision is AI.
How rule-based machine vision works
An engineer builds the inspection from deterministic tools: locate the part by pattern matching, find edges with a caliper tool, measure a diameter, check a blob’s area, read a barcode or characters, then compare each result with a tolerance. The logic is explicit, so for any part you can see exactly which measurement passed or failed and by how much.
It excels when the part, the presentation and the lighting are consistent and the question can be written as a measurement: is the hole there, is it 6.00 ± 0.05 mm, is the label within 1 mm of its position, is the date code legible.
How deep learning vision works
A neural network, usually a convolutional network or vision transformer, is trained on labeled images: good parts and each defect type, or just good parts for anomaly detection. It learns the visual features that separate them, including ones nobody could describe as a rule. At run time it outputs a class, a confidence score, boxes around defects or a pixel mask. See how AI is used in a vision system for the architecture and how much training data AI visual inspection needs for the data side.
Deep learning vs rule-based machine vision compared
| Factor | Rule-based vision | Deep learning vision |
|---|---|---|
| Best at | Measurement, presence, position, codes | Cosmetic defects, natural variation, classification |
| Setup | Engineer configures tools and tolerances | Collect and label images, train, validate |
| Training data | None | Hundreds to thousands of images; mostly good parts for anomaly detection |
| Handles natural variation | Poorly; each variation needs a rule | Well, if the variation is in the training set |
| Dimensional accuracy | High; subpixel measurement | Not a measuring tool; classifies rather than gauges |
| Explainability | Full: every number is visible | Partial: scores and heatmaps, not explicit rules |
| Speed | Very fast on a CPU | Fast on a GPU or AI accelerator |
| Validation | Gauge studies on measurements | Reject and escape rates on known-good and known-bad sets |
| When the product changes | Edit the tools and tolerances | Collect new images and retrain |
| Typical failure mode | Rejects good parts that look different | Misses defects it never saw; drifts as conditions change |
A checklist: does this inspection need deep learning?
Answer these for each inspection on the part, not for the system as a whole:
- Can the requirement be written as a number with a tolerance? If yes, start with rule-based tools.
- Do good parts vary in texture, color or shape (castings, wood, food, woven or molded surfaces)? If yes, lean toward deep learning.
- Are defects irregular, such as scratches, stains, cracks or contamination, rather than missing or mis-sized features? Lean toward deep learning.
- Do parts touch, overlap or arrive in random orientations? Deep learning segmentation usually handles this better.
- Can you collect real defect examples, or at least plenty of good parts? If neither, deep learning will struggle.
- Do auditors or customers need a measured value for every part? Keep a rule-based measurement in the loop.
- Will the product mix change often? Factor in retraining time for deep learning and re-tooling time for rules.
Hybrid systems: how most production lines do it
The two approaches complement each other, so a single station often runs both in sequence:
- Locate with rules, judge with AI. Pattern matching finds and aligns the part; a deep learning model inspects the aligned region for cosmetic defects.
- Measure with rules, classify with AI. Critical dimensions are gauged with calipers and edge tools; surface quality is graded by a classifier.
- AI first, rules to confirm. A segmentation model finds candidate defects; rule-based tools measure each one so the reject decision uses a size limit from the drawing.
- Rules for codes. Barcode and character reading stay rule-based, or use dedicated deep learning OCR where print quality varies.
Sciotex systems follow this pattern. Our robotic vision inspection system combines metrology with AI defect classification, and our counting machines use classical image analysis where it is enough and AI where parts touch or overlap.
Which approach for common inspections?
| Inspection | Usual choice | Why |
|---|---|---|
| Hole present, diameter, position | Rule-based | A measurement with a tolerance |
| Label present, position, skew | Rule-based | Geometric check on a consistent part |
| Barcode and date code | Rule-based; deep learning OCR for poor print | Standard decoders are fast and exact |
| Scratches, dents, stains on surfaces | Deep learning | Irregular defects on variable textures |
| Assembly verification (right part, right place) | Either; deep learning for many variants | Rules for few variants, AI for many |
| Counting touching or overlapping parts | Deep learning segmentation | Rules miscount merged blobs |
| Natural products (food, wood, seeds) | Deep learning | Good parts vary too much for rules |
| Unknown or rare defects | Deep learning anomaly detection | Learns normal and flags anything else |
Common mistakes
- Using AI to measure. A classifier says “out of spec” without a number; gauge with rule-based tools.
- Using AI to fix bad imaging. If lighting does not show the defect, no model will find it reliably. Fix the optics first.
- Too few real defects. A model trained on a handful of bad examples learns those examples, not the defect. Collect more, or use anomaly detection.
- Ignoring drift. New suppliers, materials or lighting changes move the images; plan monitoring and retraining from day one.
- Writing hundreds of rules for a cosmetic job. If the rule list keeps growing and false rejects stay high, that is a sign deep learning would do better.
Want an honest answer on AI vs rules for your part?
Send us sample parts. Sciotex tests both approaches and builds industrial AI systems only where AI beats classical vision, designed, programmed, built and supported in the US since 1997.
Frequently asked questions
No. Machine vision is the camera, lighting and software system that inspects parts. Much of it is rule-based. Deep learning AI is one type of software that can run in a machine vision system.
When defects are irregular or cosmetic, good parts vary naturally, parts touch or overlap, or the decision is a judgment call that is hard to write as a rule, and you can collect representative images.
For cosmetic and variable inspections, usually yes. For dimensional measurement, no: rule-based tools measure to subpixel precision and give a traceable number, which a classifier does not.
Yes, and most production systems do. A common design locates and measures the part with rule-based tools and judges surface quality with a deep learning model.
It depends mostly on data. If good and defective parts are available, a proof of concept can often be trained and tested in weeks; collecting rare defect examples is usually the longest step.