Everyone Is Selling AI Now. That Doesn't Mean You Need It.
Go to any packaging trade show or read any vision system brochure from the past three years and you will see the same language: AI-powered, deep learning, neural network, intelligent inspection. It has become the industry's favourite modifier.
The problem is that "AI" now describes everything from genuine convolutional neural networks trained on thousands of defect images — to traditional rule-based systems with a slightly modernised user interface. The term has been so thoroughly marketed that it no longer reliably indicates what a system actually does.
More importantly: even when a system genuinely uses deep learning, that does not make it the right choice for your inspection task. Knowing when AI adds value — and when it introduces unnecessary complexity — is the question worth asking.
First, Define the Terms
Rule-Based Machine Vision
Rule-based (also called algorithm-based or classical) machine vision operates through explicitly programmed logic. The system uses defined image processing algorithms — blob detection, edge detection, template matching, colour histograms, morphological operations — to find specific, predetermined features in an image.
A rule-based cap inspection, for example, checks: is a cap present (blob detection); is the cap diameter within tolerance (measurement); is the cap colour within the expected range (colour histogram); is the liner present (contrast threshold in defined ROI); is the cap at the correct height (edge position).
Every decision point is an explicit rule with a defined pass/fail threshold.
AI / Deep Learning Vision
A deep learning model is trained on a labelled dataset of images — thousands of examples of "pass" and "fail" — and learns to make a classification decision based on learned feature representations rather than programmed rules.
The model does not "know" that it is looking for a missing liner. It has learned to associate a particular pattern of pixel values with the label "defective" — because a human labelled those images as defective during training.
Critical implication: A deep learning model can only detect defect types it has seen during training. A defect class that was not in the training data is indistinguishable from a passing part — no matter how obvious it appears to a human inspector.
Where Each Approach Actually Wins
| Inspection Task | Rule-Based | AI / Deep Learning | Recommended |
|---|---|---|---|
| Cap present / absent | Excellent | Overkill | Rule-Based |
| Cap colour / code verification | Excellent | Comparable | Rule-Based |
| Liner presence inspection | Excellent | Comparable | Rule-Based |
| Fill level check | Excellent | Overkill | Rule-Based |
| Label presence / placement | Excellent | Comparable | Rule-Based |
| Wrong label / SKU mismatch | Excellent (template match) | Comparable | Rule-Based |
| Barcode / QR code reading | Excellent (OCR/barcode) | Not applicable | Rule-Based |
| Label print quality — text/graphics | Adequate | Better (pattern recognition) | Context-dependent |
| Surface cosmetic defects (cracks, burrs, inclusions) | Limited — needs well-defined defect types | Significantly better on complex/variable defects | AI preferred |
| Complex bottle shape defects (short moulding, deformation) | Adequate for defined types | Better for variable/unpredictable defects | Context-dependent |
| Foreign object detection | Limited if object type varies widely | Better — learns "not belonging" patterns | AI preferred (if data available) |
| Induction seal integrity | Excellent (thermal detection logic) | Not applicable (thermal signal is primary) | Rule-Based + Thermal |
The Pharmaceutical Compliance Reality
For pharma manufacturers operating under 21 CFR Part 11, Schedule M, EU GMP, or WHO-GMP, this is not just a technical comparison — it is a compliance question.
A rule-based system is deterministic. Given identical input images, it always produces identical outputs. The decision logic is fully documentable in a validation protocol. You can write a challenge test that definitively proves the system detects a defined defect type.
A deep learning model is probabilistic. Its outputs depend on a trained model that can change with every retrain cycle. Validating a deep learning inspection system under pharma GMP requires:
- Training data documentation (provenance, labelling protocol, version control)
- Model lock — the model cannot update automatically after validation
- Change control procedures for every model retrain or update
- Bias validation across product variation, lighting drift, and sensor ageing
- Explainability documentation where required by the regulator
Practical observation: For most pharma packaging inspection tasks — cap presence, liner check, label placement, fill level — a validated rule-based system passes audits without difficulty. Introducing AI for these tasks adds complexity without adding measurable quality improvement.
Optomech's technical team will advise on whether rule-based, AI, or a hybrid approach is appropriate for your specific inspection requirements — including regulatory compliance.
What Most People Get Wrong
The most common misconception is that AI equals higher accuracy. This is not a reliable generalisation.
For a well-defined, consistent defect type — a missing cap, a wrong label, an out-of-tolerance fill level — a well-implemented rule-based system routinely achieves >99.5% detection rate with <0.3% false rejection rate. A deep learning system on the same task may perform similarly, slightly better, or worse depending on training data quality and model architecture.
The advantage of deep learning becomes real in three specific situations:
- Defects that cannot be fully specified in advance. Surface cosmetic defects on moulded bottles — cracks, delamination, surface inclusions — come in shapes, sizes, and positions that are difficult to enumerate in a rule set. A model trained on thousands of defect examples learns a representation of "damaged surface" that generalises better than a manually constructed rule.
- Inspection tasks where product variation is high. If you run 80+ SKUs with significant surface texture, colour, and shape variation, training a product-specific deep learning model can reduce the setup time per SKU change compared to programming explicit rules for each.
- Complex multi-feature interactions. If the pass/fail decision requires integrating multiple visual signals simultaneously — not just "is the label present" but "is this label, at this position, on this bottle colour, with this print quality, for this batch code" — AI can handle the combinatorial complexity better than nested rule logic.
The Training Data Problem — Rarely Discussed Honestly
When a vendor says "AI-based detection," the first question to ask is: how many training images were used, and where did they come from?
A production-ready deep learning model for packaging defects requires:
- 1,000–5,000 labelled defect images per defect class — minimum
- Images covering the full range of lighting variation, surface variation, and defect severity
- A balanced training set — not 90% good parts and 10% defective
- Separate validation and test sets — not the same images used for training
For rare or catastrophic defects — foreign objects, cross-contamination, cap damage from a conveyor failure — the actual defect images may simply not exist in sufficient volume. This is a structural limitation of deep learning for production inspection.
Watch for this vendor pattern: Systems trained on synthetic or augmented defect images (digitally generated faults) may show impressive demo performance that does not hold up in production conditions. Always ask for validation data from a real production installation — not a lab demo.
The Hybrid Approach: Where the Industry Is Actually Heading
The most capable modern vision systems do not choose between AI and rule-based — they use each where it is appropriate within the same inspection sequence.
A hybrid architecture might look like this:
Cap present, fill level in range, label present, barcode readable — fast, deterministic, easy to validate.
Deep learning model trained on customer-specific defect images, running in parallel for complex visual quality checks.
All pass/fail decisions — from both rule-based and AI components — logged with image, timestamp, decision rationale, and operator ID.
This architecture gives you the reliability of rule-based detection for defined defects and the adaptability of AI for complex visual defects — without compromising the auditability required for pharma compliance.
Questions to Ask Before You Buy an "AI" Vision System
-
Is the AI component genuinely used for your inspection task? Ask for documentation of the AI model — input features, training dataset size, defect classes included. If the vendor cannot answer this specifically, the "AI" claim is likely marketing.
-
What is the training data source? Production images from real lines? Customer-specific data? Synthetic augmentation? Each has different validation implications.
-
What happens when the model encounters a defect class it was not trained on? An honest vendor will tell you it will likely pass. Ask how they handle this in practice.
-
How does the change control process work for model updates? If the model can update automatically, this is a compliance risk. You need a defined change control process tied to your validation framework.
-
Can you provide IQ/OQ/PQ documentation? For pharma, this is non-negotiable. Ask for a sample validation document before purchase.
Practical Takeaway
Do not buy AI inspection because it sounds advanced. Buy it because it solves a specific inspection problem that rule-based detection handles poorly.
For most pharma, FMCG, and nutraceutical packaging inspection tasks — cap and liner inspection, label verification, fill level, induction seal — a well-implemented rule-based system with proper illumination and optics will outperform a poorly trained AI model every day of the week.
Reserve AI for what it is genuinely better at: complex, variable, or incompletely specified visual defect types where rule-based logic breaks down.
Optomech's vision inspection systems use rule-based detection architectures optimised for packaging inspection — achieving >99.5% detection rates in production with false rejection rates below 0.3%. For applications where AI-based detection provides a measurable improvement, our applications team will tell you clearly — not because it justifies a higher price, but because it is the correct technical recommendation.