addaScan an addanode brand home
Guide

Rule-based inspection or deep learning: how to choose

A practical comparison for quality and technical managers: where each fits, what samples each needs, and how each is validated and maintained.

By addaScan engineering teamTechnical review: Frank GuoPublished 8 min read

Assess your defect type
// Short answer

Use rule-based tools when the fault can be defined as a measurement or rule: a missing part, a position, a dimension, a code. Consider deep learning when defects vary in shape and appearance on a naturally variable surface and fixed rules would need endless exceptions. Deep learning needs more labelled images and a retraining plan; rules need stable imaging and clear limits. Many stations combine both, and HIKROBOT VisionMaster offers both. The choice is confirmed on your samples.

Key points

  • Start from the defect: if it can be defined as a measurement or a rule, rule-based tools usually fit.
  • Deep learning suits defects whose shape and appearance vary on a naturally variable surface.
  • Neither method finds a defect the image does not show; lighting and optics come first.
  • Deep learning moves effort from writing rules to collecting and labelling images, and to retraining.
  • Both are validated the same way, and both can run in one VisionMaster solution.

What each approach is

Rule-based inspection is a chain of tools an engineer builds and tunes: find the part, measure an edge, count objects, read a code, compare the result with a limit. Every decision can be traced to a measured value and the limit it was compared with. When the image is stable, the result is predictable and easy to explain in an audit.

Deep learning uses a model trained on labelled images. Instead of writing rules, you show it examples of good and defective products, and it learns to classify an image, detect and locate objects, or mark defect regions pixel by pixel. Some methods learn only from good samples and flag anything unusual. The model returns a score or a region; people still set the threshold that turns it into pass or fail.

Neither method can find a defect the image does not show. If lighting and optics do not make a scratch stand out, no algorithm will catch it reliably, which is why every project starts with a sample test.

Where each approach fits

Rule-based tools fit defined, measurable faults: presence and absence, position and orientation, counting, dimensions against a tolerance, fill height on transparent containers, barcode and 2D code reading, and verification of printed text in a consistent font.

Deep learning fits variable appearance defects: scratches, marks, dents and contamination on textured or naturally variable surfaces; moulding faults that never look the same twice; difficult print for character reading; and sorting products into classes that are easier to show than to define.

Many stations combine them. Rules locate the part and read the code; a deep-learning module inspects the cosmetic area; a rule then measures the size of any defect found against the agreed limit. See surface defect detection for how this applies to scratches, marks and moulding faults.

Sample needs

Rule-based setup needs fewer images, but they must cover normal variation so limits are set where good product actually sits, plus defect samples to confirm each rule catches the fault.

Deep learning needs labelled images of each defect class across its variation. Rare defects are the hard part: if a fault appears seldom, collecting enough examples takes time. Labelling must be consistent. If two inspectors disagree about a borderline part, the model learns the disagreement. Methods trained on good samples reduce the need for defect images during training, but not during validation. The sample preparation guide explains how to build and label a representative set.

Validation

Both methods are accepted the same way. An agreed set of good and defective samples, kept separate from anything used for setup or training, is run through the station at line speed. Two figures are counted: false rejects (good products rejected) and missed defects (defects passed). The number of good and defective samples, their mix and the test speed are recorded, so each figure has a clear basis.

A small test with no misses shows the method works on those samples; it does not prove the station will miss no defects in long-term production. Borderline cases are decided with your quality team, not by the algorithm.

Changeover and retraining

With rule-based tools, a new product usually means a new recipe: teach a reference, set the limits, check on samples. Small visual changes often fit within existing limits.

With deep learning, a new product, a new material or a supplier change that alters appearance can mean collecting new images and retraining, or keeping a model per product. Plan who does this, how each model version is named and stored, and how it is re-validated before it goes live.

Maintenance over the station's life

For both methods, stable imaging is the first maintenance task: clean lenses and covers, lighting that has not aged or shifted, and mounts that have not moved. A reference set of known good and defect samples, run at agreed intervals, shows early whether results are drifting.

Rule-based stations drift when the image changes and limits no longer fit. Deep-learning stations also need an archive of labelled images, a record of model versions, and agreed triggers for retraining, such as a new product or a rise in false rejects.

Cost and effort

We do not quote figures here; effort depends on the product and the defects. The pattern is:

  • Rule-based: most effort is engineering time to build, tune and document the tool chain.
  • Deep learning: effort shifts to collecting and labelling images, training, validation and later retraining. Hardware may change too: HIKROBOT states that VisionMaster deep-learning inference runs on CPUs or NVIDIA GPUs, and supplies the deep-learning modules as a separate supplemental package (HIKROBOT Download Center). Check what the software scope of a quotation includes. The cost and budget guide covers the other cost drivers.

Decision table

Use these questions to find which way a check leans. The final choice is made on your samples.

Decision table: rule-based inspection or deep learning
QuestionPoints to rule-basedPoints to deep learning
Can the fault be described as a measurement, count or rule?Yes: position, size, presence, a code or a fill height.No: it is easier to show examples than to describe it.
How much does good product vary in appearance?Little: consistent colour, texture and print.A lot: natural texture, grain, moulding or print variation.
How varied is the defect itself?Predictable shape and position.Varies in shape, size, contrast and position.
How many labelled defect images can you collect?Few are available.Enough examples of each defect type, with room to collect more.
Must each decision be explained by a measured value?Yes, for example against a drawing tolerance.A score, with a highlighted region, is acceptable.
How often do products, materials or suppliers change?Often, with small visual changes a limit can absorb.Rarely, or you can plan retraining for each change.
Who will own the method after handover?Technicians who adjust limits and references.A team trained to label images, retrain and re-validate.

Both in one VisionMaster solution

addaScan builds stations on HIKROBOT VisionMaster. We use the platform as an independent integrator; this website does not claim any official HIKROBOT partnership or distributor status. What follows is vendor-stated and describes the software, not a result on your product.

  • HIKROBOT describes VisionMaster as machine vision software with algorithm tools for positioning, size measurement, defect detection and information recognition (VisionMaster product page).
  • It lists deep-learning modules for classification, object detection, character positioning and recognition, and segmentation, as well as defect heat-mapping, few-sample registration learning and anomaly detection trained on normal samples only (VisionMaster product page).
  • The current deep-learning supplemental package (V4.4.0) lists GPU and CPU modules for image segmentation, instance segmentation, object detection, character recognition, image classification, OCR and code reading, plus registered and edge learning. The earlier V4.3.0 package also lists anomaly detection, image retrieval and unsupervised image segmentation (HIKROBOT Download Center).

In practice this means rule-based tools and deep-learning modules can sit in one solution and one recipe, so a station does not have to choose one method for every check. The VisionMaster integration page explains what the platform provides and what we deliver around it.

// FAQ

Questions about choosing a method

When is deep learning useful for surface defect inspection?
When the defects vary in shape, size and contrast, and the good surface itself varies, so fixed rules would reject good parts or miss real faults. Typical examples are scratches, marks and moulding faults on textured or variable surfaces. It still needs lighting that makes the defect visible, and enough labelled images of each defect type.
Is deep learning more accurate than rule-based inspection?
There is no general answer. Each method does well on the problems it suits and poorly on the others. The only meaningful comparison is on your own samples, measured as false rejects and missed defects on a test set that was not used for setup or training.
Does deep learning need a very large image set?
It depends on how much the product and defects vary. Some modules, such as anomaly detection, are trained on good samples only, but defect examples are still needed to prove that the model catches what matters. Quantities are agreed per project.
Can our own team retrain a deep-learning model?
It can, if the handover includes training on labelling, retraining and re-validation, and a controlled way of approving a new model. Whether that is included is agreed in the project scope.
Can one station use both methods?
Yes. A common pattern is to locate the part and read codes with rule-based tools, then check a region for cosmetic defects with a deep-learning module. VisionMaster provides both kinds of tools in one platform, according to HIKROBOT.

Sources

  1. HIKROBOT VisionMaster product page (vendor page, checked 2026-09-24; algorithm tools and deep-learning modules)
  2. HIKROBOT Download Center, VisionMaster listing (vendor download listing, checked 2026-09-24; deep-learning supplemental packages)
// Next step

Not sure which method your defect needs?

Send photos of good and defective products and describe how the defect varies. We will tell you which approach we would test first, and what samples that needs.

Start an assessment