Deep Learning vs Traditional Machine Vision: When Should You Use AI?
When should you move from pattern matching, blob and edge tools to deep learning? A comparison, a checklist and Cognex tools for cosmetic defects.
When should you move from pattern matching, blob and edge tools to deep learning? A comparison, a checklist and Cognex tools for cosmetic defects.
Your line has run well for months on pattern matching and edge measurement. Then a new batch arrives with a slightly different surface, faint scratches, stains that change shape, and false rejects climb. At this point many factory engineers ask: should we move to deep learning in machine vision, or simply retune the traditional algorithms? This article helps you decide with a comparison table and a selection checklist, using surface defect inspection as the main example.
One point up front: deep learning does not fully replace traditional algorithms. Each is strong on a different class of problem, and many of the best systems use both.
Traditional, or rule-based, vision relies on explicit rules defined by an engineer. The familiar tool families are:
The biggest advantage is explainability: when the system reports NG, you know exactly which threshold was crossed. Processing is typically fast, hardware is light (many applications run directly on a smart camera), and you do not need a large library of defect images. The weakness appears when the shape of the defect, or of the background, cannot be captured by a handful of rules.
With deep learning you do not write rules. You provide labeled images (for example OK/NG, or outlined defect regions) and a neural network learns the features that separate them. This approach suits tasks that are hard to program in the conventional way. For visual inspection, it means the system can learn what "normal" looks like even when the surface has texture, reflections or colour variation from part to part.
The trade-off is that you need good image data, a training and validation process, and usually stronger hardware. Results are also harder to explain: the model returns a score or a suspect region, not a specific threshold.
| Criterion | Traditional algorithms | Deep learning |
|---|---|---|
| How it is built | Engineer sets rules, thresholds, parameters | Trained from labeled images |
| Best suited to | Localization, gauging, counting, clear code reading | Varied cosmetic defects, noisy backgrounds, variable surfaces, complex classification |
| Data needed | A few sample images to tune parameters | An image set that represents all real-world variation |
| Unseen defects | Caught only if the rules cover them | Unsupervised modes can flag deviations from "good" images |
| Explainability | High, every threshold can be traced | Lower, needs heatmaps and a test set to build trust |
| Hardware | Usually CPU or smart camera | Many modes need an NVIDIA GPU, especially for training |
| Maintenance | Retune parameters when the product changes | Add images and retrain when the product or background changes |
Real-world speed and accuracy depend on the application, the input images and the hardware, so always test on real samples before drawing conclusions.
Picture a machined metal part or a textured panel. The defects to catch are scratches, stains, dents and colour deviations. With the traditional approach you usually run into:
This is where deep learning often has the edge: the model learns the full range of normal variation in the background and flags what falls outside it. However, lighting and optics still decide most of the image quality. If a scratch does not show up in the image, AI will struggle to rescue it. If you are choosing lighting for surface defects, see our article on the OPT RBV9855-W diffuse dark-field square light, and our overview What is machine vision if you are just starting.
For a broader view of defect inspection solutions, visit BeeVision's visual inspection page.
Answer these questions for your application:
Rule of thumb: if most answers are "describable, stable background", keep rule-based. If most are "variable, diverse, hard to describe", try deep learning. If you land in between, combining both is often the right choice: use pattern matching to locate the part, then deep learning to inspect the surface inside the located region.
BeeVision, a Cognex partner and Cognex distributor in Vietnam, supplies the Cognex VisionPro Deep Learning library and supports its integration for many large customers in Vietnam. It is a set of machine vision tools that use deep learning for tasks that are hard to program conventionally, with a standalone GUI called Cognex Deep Learning Studio and APIs for application development (more at cognex.com). There are four tool groups:
This is the core tool for visual inspection. Red Analyze learns the normal appearance of the zone being inspected in order to detect anomalies and aesthetic defects, with Focused Unsupervised, Focused Supervised and High Detail modes.
A common pattern is to use an unsupervised tool first to filter anomalies, then supervised tools for the harder defects.
Green Classify classifies objects or whole scenes from a set of labeled images, with Focused, High Detail and High Detail Quick modes. It can sit after Red Analyze to classify the type of defect found (scratch, stain, dent and so on), which is very useful for tracing defect causes back to a production step.
Blue Locate finds and localizes one or more features in an image, learning from annotated images. It is used for fixturing, counting and assembly verification. It is useful when classic pattern matching fails because the part deforms or the background is cluttered.
Blue Read reads characters, including codes that are deformed, skewed or poorly etched. It comes with a pre-trained font library that identifies most text without additional font training, and it can be retrained when needed.
| Problem | Suggested tool | Note |
|---|---|---|
| Surface defect detection, few defect images | Red Analyze (Unsupervised) | Quick start with good images |
| Faint scratches, pale stains, hard defects | Red Analyze (Supervised / High Detail) | Needs defect images with marked regions |
| Classifying defect type or product type | Green Classify | Can follow Red Analyze |
| Locating, counting, assembly checks when parts vary | Blue Locate | An option when pattern matching is unstable |
| Difficult character reading (faint, skewed, deformed) | Blue Read | Pre-trained font library |
There is no single minimum image count for every application, and these tools need much smaller image sets than conventional deep learning. So do not trust any "you need exactly N images" claim without testing on real samples. Practical rules:
VisionPro Deep Learning supports NVIDIA GPUs only. For release VPDL 3.3.x, the GPU must be CUDA-capable with compute capability 6.1 or higher; a training PC needs 10 GB or more of GPU memory and a deployment PC 8 GB or more, and High Detail tools call for more. Focused-mode tools can run without a GPU, but High Detail tools cannot be processed without one. Requirements change between versions, so check the exact version you will use before specifying hardware. BeeVision engineers can help you choose the GPU and the right PC-based vision system.
The workflow typically has two phases: training (on a GPU-equipped PC) and processing (running the trained model on new images). Models can be deployed through the runtime environment or the runtime API, and a trained tool can be exported and imported into VisionPro as a tool block. That lets you combine deep learning with traditional tools in one program. PCs running the software need a valid Cognex Security Dongle. Cognex also offers some AI tools on the In-Sight platform; if you are interested in the smart camera route, read about Edge Learning technology.
When bringing it onto the line, plan for: the trigger signal and PLC connection, processing time within the cycle, saving NG images for traceability and retraining, and a process for updating the model when the product changes.
No. For gauging, localization or clear code reading, rule-based tools are often faster, more stable and easier to explain. Deep learning has the advantage when defects and backgrounds vary. Accuracy depends on the application and must be verified with real samples.
You can start with Red Analyze's unsupervised mode, which needs only good images. If defects are not salient enough, you will need to collect defect images and move to a supervised mode.
Yes, and it is common: traditional tools for locating and measuring, deep learning for judging the surface. See also our article on deep learning in machine vision for quality inspection.
The fastest way to learn which approach fits your application is to test it on real samples. Send OK/NG samples or images and BeeVision engineers will run the test and recommend the camera, lighting and software setup. Start on the send samples for a POC page. You can also explore Cognex solutions and follow BeeVision on LinkedIn and YouTube for weekly machine vision insights.
You have decided to bring machine vision onto your line, and two quotes are sitting on your desk. One proposes an industrial smart camera mounted directly at the inspection…
Thousands of parts move down a conveyor every shift. A QC operator has to look at each one for scratches, missing components, crooked labels or a smudged lot code. By the sixth…
Overview: Cognex and Keyence – The Two Giants of Machine Vision When investing in an automated visual inspection system, the Cognex vs Keyence question comes up in almost every…