Two different approaches
Rule-based vision uses tools that an engineer configures: find an edge, measure a distance, count blobs, match a pattern, read a code. Each check has explicit thresholds. If the gap is wider than a set limit, the part fails.
Deep learning vision trains a neural network on example images. Instead of writing rules, you show the system labeled examples of good parts and defects, and it learns the visual patterns that separate them. Both are mature tools, and many good systems use both on the same part.
When rule-based vision fits
Rule-based tools are the right choice when the question can be stated precisely:
- Measuring dimensions, positions and gaps against tolerances
- Checking presence or absence of a feature in a known location
- Reading barcodes, data matrix codes and printed text
- Locating parts for robot guidance where the part is consistent
- Verifying a label, color or orientation against a reference
These checks are predictable, fast to explain and easy to audit. When a part fails, you can see which rule failed and by how much. If a rule-based tool can do the job reliably, it is usually the simpler system to own.
The weakness of rules shows up when appearance varies. Every new exception becomes another threshold or another tool, and over time the program becomes fragile. When the rule set needs constant retuning to stop false rejects, it is worth considering a trained model.
When deep learning fits
Deep learning earns its place when defects vary in ways that are hard to describe with rules. Scratches that differ in length and direction, porosity, contamination, wrinkles, cosmetic flaws on textured surfaces and natural products such as food all fall into this group.
It also helps when the good part varies. Wood grain, cast surfaces and produce all look different from piece to piece, which makes fixed thresholds trip on acceptable parts. A trained model can learn what normal variation looks like and flag what falls outside it.
Deep learning does not fix poor images. Lighting, optics and part presentation still need to show the defect clearly. If a trained inspector cannot see the defect in the image, the model probably cannot either.
There is a cost side as well. A deep learning project needs time to collect and label data, computing hardware for training, and a plan for updates. Those costs are worth it for the right problem, and unnecessary for a check a simple measurement can handle.
Collecting the right data
A model learns from the images it is given, so the dataset defines what it can do. Collect images on the actual station, or one built the same way, with production lighting, camera and part handling.
- Good parts across the full range of normal variation
- Every defect type you need to catch, at a range of severities
- Parts from different shifts, lots, suppliers and tools
- Borderline cases that inspectors disagree on
- Images showing contamination, glare or position shifts that occur in production
Rare defects are the hard part. Plan time to collect them, keep defect samples as a library, and consider anomaly detection, which trains mostly on good parts, when bad parts are scarce.
Labeling defines the standard
Labels teach the model your quality standard. If two inspectors label the same image differently, the model learns that confusion. Before labeling starts, write down defect definitions with example images and agree on where the line between pass and fail falls.
Use people who know the product. Review a sample of labels for consistency, and resolve borderline cases as a team. Time spent here is repaid in a model that agrees with your quality department.
Labeling style depends on the task. Classification labels each image as good or a defect type. Detection and segmentation mark where the defect is, which takes longer but gives the model more to learn from and makes results easier to review.
Validating before you trust it
Hold back a test set of images that were never used in training, and measure the model against it. Track both escapes, where a bad part passes, and false rejects, where a good part fails. Decide in advance which matters more for your product and set the decision threshold accordingly.
Then validate on the line. Run the system alongside your current inspection for a period, compare decisions, and review every disagreement. Agree on acceptance criteria before the test, just as you would for a factory acceptance test.
Keeping a model current
Products, materials and suppliers change. A new resin, a different cutting tool or a new packaging film can shift how parts look, and model performance can drift as a result.
- Save images of rejects and a sample of passes for review
- Watch reject rates and investigate sudden changes
- Retrain with new examples when the product or process changes
- Keep version control of models and the data used to train them
- Revalidate against the test set after every update
Decide who owns this work. Some plants handle retraining in-house with tools from the integrator. Others prefer a support agreement. Either works, as long as someone is responsible.
Using both together
Many inspection stations combine approaches. Rule-based tools locate the part, read the code and measure critical dimensions. A deep learning tool then judges the cosmetic surface. Each does the part of the job it is best at, and results are easier to explain when something fails.
Ready to start
See our vision inspection and AI vision pages for the systems we build. Send samples of good parts and each defect type through the quote form, and we will test which approach fits before we quote.

