Machine vision inspection
Machine vision inspection uses cameras, optics, lighting and a controller to make automated accept/reject decisions on every unit — label and OCR verification, fill-level checks, seal integrity, presence/absence, barcode grading and cosmetic-defect detection.
Read the full summary
This page covers the hardware building blocks, 1D/2D/3D and line-scan systems, rule-based vs deep-learning vision, how a vision system is validated under GAMP 5 and FDA process validation with gauge R&R and challenge sets, how false-accept/false-reject rates are qualified and monitored, how Part 11 treats inspection images as electronic records, reject-image retention, integration with the batch record and nonconformance flow, and the failure modes — lighting drift, uncontrolled model retraining, and threshold changes made without an audit trail — that turn a vision station into a data-integrity liability.
On this page · 11 sections
- 1What machine vision inspection is
- 2The building blocks: camera, optics, lighting, controller
- 31D, 2D, 3D and line-scan systems
- 4Typical applications in regulated production
- 5AI/deep-learning vision vs. rule-based vision
- 6Validating a vision system under GAMP 5 and FDA process validation
- 7Gauge R&R and challenge sets
- 8Qualifying false-accept and false-reject rates
- 921 CFR Part 11: images as electronic records
- 10Reject-image retention and batch record / nonconformance integration
- 11Failure modes: lighting drift, uncontrolled retraining, unaudited threshold changes
How does Machine vision inspection apply to your shop floor?
Pick your industry and scale — Ask V5 rewrites the definition in your context, gives a worked example, and shows what V5 does on day one.
01What machine vision inspection is
Machine vision inspection is the use of a digital camera, optics and controlled lighting, feeding a processing unit running image-analysis algorithms, to make an automated pass/fail or measurement decision on every unit passing a station — without a human looking at each one. In regulated manufacturing it typically replaces or augments manual visual inspection, AQL sampling, or a checkweigher-only check, and it produces a record for every unit: an image, a decision, a set of measured features, and a timestamp.
The appeal is straightforward: a camera doesn't get tired at hour seven of a shift, doesn't vary its judgment call between operators, and produces evidence of what it saw. The risk is equally straightforward: a vision system that isn't controlled as tightly as any other GMP measurement instrument can silently drift, silently pass bad product, or silently fail good product — and because it runs unattended, nobody notices until a complaint, a recall, or an audit finding surfaces it.
This page treats vision as what it is under GxP: a measurement system that happens to use a camera instead of a caliper, a scale, or a titration. Every rule that applies to instrument qualification, method validation and change control applies here too — with the added twist that the 'method' is often a trained model rather than a fixed algorithm.
02The building blocks: camera, optics, lighting, controller
A vision station is a chain, and the weakest link in the chain determines the ceiling on inspection reliability. Four components matter, in this order of practical importance:
- Lighting — the single most decisive and most under-invested-in component. Ring lights, backlights, dome/diffuse lights, dark-field and coaxial lighting each reveal or hide different defect classes (surface scratches need dark-field/raking light; transparent-container fill level needs backlight; specular labels need diffuse/dome light to kill glare). Ambient light leaking into the field of view is the single most common root cause of intermittent false rejects and false accepts.
- Optics (lens) — determines field of view, working distance, depth of field and resolution at the feature of interest. A lens chosen for a wider field of view than the defect requires under-resolves the defect; one that magnifies too far starves depth of field on a container that isn't perfectly positioned.
- Camera / sensor — area-scan (2D snapshot, most common), line-scan (builds an image line-by-line as continuous web or round product moves past, used for high-speed continuous webs and 360° container inspection), and 3D (structured light, laser triangulation, or time-of-flight, used for volume, profile and fill-level measurement that a 2D image can't resolve).
- Controller / processing unit — runs the image-processing pipeline (rule-based feature extraction, or a trained deep-learning model, or both), makes the accept/reject decision, and communicates the result to the line PLC, reject actuator, and the MES/eBR.
031D, 2D, 3D and line-scan systems
| Type | What it captures | Typical use |
|---|---|---|
| 1D vision / photoeye array | Presence, edge position, simple counting along a single axis | Presence/absence gating, jam detection, simple part counting |
| 2D area-scan | A single flat image (X-Y) per trigger | Label OCR/OCV, barcode read/grade, presence-absence, cosmetic surface defects, print registration |
| Line-scan | Continuous 1-pixel-wide line stitched into an image as the web or round object moves | Continuous webs (film, foil, printed sheet), 360° inspection of round containers/vials via rotation under the line, very high line speeds |
| 3D (structured light / laser triangulation / ToF) | Height, volume, profile, surface topology | Fill-level and headspace measurement, weld/seal bead profile, dimensional gauging, particulate settling patterns |
Most production lines combine types: a 2D camera for label OCR and barcode grade, a 3D sensor for fill level on the same station, and a line-scan camera further downstream for continuous film inspection before slitting. Each sub-system has its own qualification record, its own trigger logic, and its own reject criteria — treat them as separate measurement instruments even when they share a single enclosure and PLC tag.
04Typical applications in regulated production
- Label and print verification (OCR/OCV) — confirms lot number, expiry date, NDC/GTIN and text block match the approved artwork and the batch's intended values; catches wrong-label and mixed-lot events at the point of application rather than downstream.
- Barcode/2D symbol grading — reads the code and additionally grades print quality against ISO/IEC 15415 (2D symbols, e.g. Data Matrix/GS1 DataMatrix used for serialization) and ISO/IEC 15416 (linear/1D barcodes), scoring on decode, symbol contrast, modulation and defects on an A–F scale so marginal codes are caught before they fail at a customer's scanner rather than at the pharmacy or distribution center.
- Fill-level / headspace inspection — 3D or backlit 2D measurement of liquid or powder fill height in transparent or translucent containers, catching under-fill (dosing/efficacy risk) and over-fill (container-closure integrity risk).
- Seal integrity — inspects seal width, wrinkles, contamination in the seal area, and (with thermal or specialized imaging) incomplete seals on blister, pouch and lidding operations.
- Presence/absence checks — desiccant present, tamper band present, insert/leaflet present, cap present and torqued, correct component count in a kit.
- Cosmetic and particulate defect detection — surface scratches, discoloration, foreign particulate in liquid-filled vials or ampoules (often using rotating-inspection stations with backlight and dark-field combined), capsule/tablet chips and color variation.
In every one of these applications the vision system is replacing, or supplementing, a decision a human previously made by eye — which is exactly why it must be validated to at least the same standard, and ideally a higher and more consistent one, than the manual process it replaces.
05AI/deep-learning vision vs. rule-based vision
Rule-based (classical) machine vision extracts explicit features — edge position, blob area, greyscale threshold, pattern-match score, OCR character confidence — using deterministic algorithms whose parameters an engineer sets and documents. Given the same image and the same parameter set, a rule-based system always produces the same result. That determinism is precisely what makes it easy to validate: the acceptance criteria are the parameter values, and the decision boundary can be written down in the qualification protocol.
Deep-learning (AI) vision trains a neural network on a labeled image set to classify defects that are hard to describe as explicit rules — subtle cosmetic variation, complex particulate patterns, natural-material variability (produce, botanicals, textiles). The trade-off is that the decision boundary lives inside millions of trained weights rather than a handful of documented thresholds, which means the model itself — not just its configuration — is part of what must be validated, locked, and version-controlled.
| Dimension | Rule-based vision | Deep-learning vision |
|---|---|---|
| Decision logic | Explicit thresholds/parameters, human-readable | Learned weights, not human-readable |
| Best for | Well-defined geometric/print/presence checks | Complex, high-variability cosmetic/natural defects |
| Validation approach | Challenge set + parameter document + gauge R&R | Challenge set + training/validation/test data governance + gauge R&R + model version lock |
| Change control unit | Parameter file | Model artifact (weights) + training dataset lineage |
| Drift risk | Lighting/lens drift | Lighting/lens drift + data drift + silent retraining |
06Validating a vision system under GAMP 5 and FDA process validation
A production vision station is a computerized system controlling a GMP decision, so it falls under GAMP 5's risk-based categorization — typically Category 3 (configured product, off-the-shelf inspection software with recipe-level configuration) or Category 4/5 (configured or custom, where site-specific algorithms, models or integration logic are built). The category drives the depth of the validation deliverables, but the sequence is the same one used for any automated inspection instrument:
- User Requirements Specification (URS) — what defects/attributes must be detected, at what size, at what line speed, with what acceptable false-accept and false-reject rates, and what the reject/downstream disposition must be.
- Design/Functional Specification — camera, optics, lighting, trigger source, decision logic (or model architecture and training approach), interfaces to PLC/reject actuator/MES.
- IQ (Installation Qualification) — confirms the specified hardware is installed as designed: camera model/serial, lens, lighting type and intensity setting, mounting geometry, cabling, firmware/software version.
- OQ (Operational Qualification) — challenges the system across its full operating envelope (line speed range, product variants, lighting warm-up) using a defined challenge set (see below) and confirms it decides correctly at every point.
- PQ (Performance Qualification) — runs the system under real production conditions, typically across multiple lots/shifts/operators, confirming sustained performance and that the false-accept and false-reject rates stay within the qualified limits under normal production variability.
- Ongoing monitoring — periodic requalification, challenge-set re-runs after any change, and continued verification consistent with FDA's Stage 3 process-validation expectations.
FDA's process validation guidance treats an automated inspection step the same as any other process step that must be shown to reliably and consistently do what it is intended to do — with the added expectation, for anything with a software decision layer, that FDA's software validation principles (documented requirements, traceable test cases, defined acceptance criteria) are satisfied on top of the equipment qualification.
07Gauge R&R and challenge sets
A vision system making a pass/fail call is an attribute measurement system, and it should be qualified the way any attribute gauge is qualified under AIAG MSA methodology: repeatability (does the same unit, imaged repeatedly, get the same call?) and reproducibility (does the call hold across cameras, lighting warm-up states, and — where applicable — line speed or operator-loaded fixture variation?). Attribute gauge R&R for vision typically reports percent agreement, and for borderline units, Kappa statistics against a known reference/expert panel decision.
The challenge set is the deliberately constructed image/unit library used to prove the system across the full range it must handle, not just the easy cases. A well-built challenge set includes:
- Known-good units spanning the full range of acceptable natural variation (not just one 'golden' sample).
- Known-defective units at, above and just below the defect-size or defect-severity threshold — the boundary cases are where a vision system actually earns its qualification.
- Edge-of-envelope units: minimum and maximum line speed, worst realistic lighting condition (e.g., end of a lamp's rated life, warm-up state), and any product variants the line runs.
- A held-out 'blind' subset the vision engineer did not see while tuning parameters or training the model, run at the end of OQ/PQ so the reported pass rate isn't inflated by having been used to fit the very thresholds being tested.
08Qualifying false-accept and false-reject rates
Two error rates matter, and they trade off against each other by moving the decision threshold: false-accept rate (FAR — a defective unit that the system passes; the patient-safety/quality risk) and false-reject rate (FRR — a good unit the system scraps or diverts; the yield/cost risk). The URS should specify a maximum acceptable FAR (often driven by the risk class of the defect — a mislabeled dose has a near-zero tolerable FAR; a minor cosmetic blemish may tolerate a higher one) and a target FRR that keeps the line economically viable.
During OQ/PQ, FAR and FRR are calculated directly from the challenge-set results (known-defect units missed ÷ total known-defect units = FAR; known-good units rejected ÷ total known-good units = FRR) with a confidence interval appropriate to the sample size — a challenge set of 30 defective units barely supports a point estimate, let alone a tight upper confidence bound, so risk-critical checks need larger, statistically planned challenge sets, not a convenience sample.
In production, FAR can't be measured directly (a false accept, by definition, wasn't caught) but it is monitored indirectly: downstream complaint rate for the defect class the vision station is supposed to catch, periodic manual audit-sampling of accepted product, and trending of the reject rate itself — a reject rate that drifts sharply up or down with no process change is usually a threshold or lighting problem, not a sudden change in incoming quality, and should trigger an investigation before anyone touches the threshold.
0921 CFR Part 11: images as electronic records
An inspection image captured to support an accept/reject decision on a GMP unit is an electronic record within the scope of 21 CFR Part 11 when it is part of a required record or is relied on to demonstrate compliance — which most reject images and many accept-image samples are. That means the same Part 11 controls apply as to any other electronic GMP record: system access controls, an audit trail of who/what changed a decision or a threshold, protection against unauthorized alteration or deletion of the image or the associated result, and — where a human reviews and overrides a vision decision — a Part 11-compliant electronic signature on that override, not a free-text comment.
In practice this means the vision controller (or the MES it feeds) must record, immutably: the image itself (or a defined retention subset, see below), the measured feature values, the decision made, the parameter set/model version in effect at the time, the timestamp, and the equipment/station identifier — and must log any subsequent human review or disposition change against that record with attribution and reason, exactly as it would for a manual inspection entry.
10Reject-image retention and batch record / nonconformance integration
Storing every image from every unit at production line speed is often impractical at scale — a station running 300 units/minute with a full-resolution image per unit generates a very large volume very quickly. Most sites define a risk-based retention policy in the validation package rather than defaulting to 'keep everything' or 'keep nothing':
- All reject images retained for the full record-retention period applicable to the batch (these are the evidence a quality reviewer or auditor will actually ask to see).
- A statistically defined accept-image sample retained (e.g., first-of-run, periodic interval, or a fixed percentage) to support trending, audit and requalification without retaining every accepted unit's image.
- Full-resolution retention around any investigation window (e.g., all images ± N minutes of a confirmed deviation) regardless of the default sampling rule.
- A documented, approved retention period and archival/retrieval method — 'stored on the vision vendor's local hard drive with no backup' is a data-integrity finding waiting to happen, not a retention policy.
Integration with the batch record and the nonconformance flow is what makes the inspection data useful rather than just archived: the vision station's lot/batch ID (from a barcode read, a PLC handshake, or an MES work-order context) should be attached to every inspection result so a reviewer can pull all vision dispositions for a batch alongside every other in-process check, and every reject above a defined threshold — a single unit, a run of consecutive rejects, or a reject-rate spike — should auto-generate or prompt a nonconformance record rather than relying on an operator to notice and manually file one.
11Failure modes: lighting drift, uncontrolled retraining, unaudited threshold changes
The three failure modes below account for most vision-related audit findings and field problems, and all three share the same root cause: treating the vision station as 'just a camera' rather than as a validated measurement instrument with a documented method.
| Failure mode | How it happens | How it's prevented |
|---|---|---|
| Lighting drift | LEDs dim with age and heat cycling; ambient light changes with time of day, nearby equipment, or a maintenance tech propping a door open; a bulb is swapped for a 'compatible' one that isn't spectrally identical. | Photometric monitoring (intensity feedback in the controller), scheduled light-output verification with a reference target, enclosed/shielded stations, and change control on any lighting component swap. |
| Model retraining without change control | A vision engineer, chasing a nuisance false-reject rate, retrains or fine-tunes the model on recent production images and pushes it live to 'fix' the line — with no re-run challenge set, no version record, and no approval. | Model artifacts under formal configuration/version control, retraining treated as a method change requiring a documented protocol, challenge-set re-run and QA approval before go-live, with the previous model retained and rollback-capable. |
| Threshold changes with no audit trail | An operator or technician adjusts a sensitivity slider or a pass/fail threshold directly in the vision software's local interface to clear a jam or reduce nuisance rejects, without it flowing into the site's change-control or electronic-record system. | Threshold/recipe parameters stored and edited only through a system that Part-11-audit-trails every change (who, when, old value, new value, reason), with local vision-software access locked down or read-only for anyone outside the qualified configuration role. |
A useful gemba question for any vision station: 'if the reject rate on this station changed by 5x tomorrow, would anyone know within a shift, and could they see exactly what changed?' If the honest answer is no, the station has a data-integrity gap regardless of how good the underlying optics and algorithms are.
Frequently asked questions
Q.Is machine vision inspection required to validate the way an HPLC method is validated?+
Not identically, but the same underlying expectation applies: a documented method (parameters or model), objective evidence it does what it's meant to do across its intended operating range (OQ/PQ with a challenge set), and change control before the method changes. GAMP 5 governs the computerized-system side; process validation and, where applicable, software validation principles govern the method-performance side.
Q.Can a vision system fully replace manual visual inspection or AQL sampling?+
Often yes for well-defined, camera-detectable attributes (label content, barcode grade, fill level, presence/absence), provided the qualification demonstrates equal or better detection performance than the process it replaces, including at the boundary cases in the challenge set. It rarely eliminates the need for periodic manual audit-sampling as an independent check on the automated system itself.
Q.How is a deep-learning vision model different from a rule-based one for validation purposes?+
The decision logic in a rule-based system is a set of documented parameters; in a deep-learning system it's a trained set of weights that can't be read as a formula. Validation still uses IQ/OQ/PQ and a challenge set, but the change-control unit becomes the model artifact plus its training-data lineage, and retraining must be treated as a method change requiring re-verification before deployment.
Q.What barcode grading standard applies to serialization codes like GS1 DataMatrix?+
ISO/IEC 15415 covers 2D symbol print-quality grading (used for GS1 DataMatrix and similar codes common in pharma serialization); ISO/IEC 15416 covers linear/1D barcode grading. Both grade on an A–F (or 4.0–0.0) scale across parameters like decode, symbol contrast, and modulation, not just whether the code scans.
Q.Do reject images have to be kept forever?+
No — most sites define a risk-based retention policy: full retention for reject images (and often around investigation windows) for the applicable record-retention period, with a smaller, statistically defined sample of accept images retained for trending. The policy itself must be documented and approved as part of the validation package, not decided ad hoc by whoever configures the vision software.
Q.Who is allowed to change a vision system's pass/fail threshold?+
Only someone in a role authorized by the site's change-control procedure, using a system that captures the change in an audit trail (old value, new value, who, when, why) — not directly in the vision vendor's local configuration screen with no downstream record. Nuisance-reject pressure on the floor is a common but invalid reason to bypass this.
Q.What's the difference between false-accept rate and false-reject rate, and which matters more?+
False-accept rate (FAR) is a defective unit incorrectly passed — the quality/patient-safety risk. False-reject rate (FRR) is a good unit incorrectly scrapped or diverted — the yield/cost risk. Which matters more depends on the defect's risk class: a mislabeled dose warrants driving FAR toward zero even at some FRR cost, while a minor cosmetic check may tolerate more balance between the two.
Primary sources
- FDA — Process Validation: General Principles and Practices (2011)
- FDA — 21 CFR Part 11, Electronic Records; Electronic Signatures
- FDA — Part 11 Scope and Application guidance (2003)
- ISPE / GAMP 5 (2nd ed.) — A Risk-Based Approach to Compliant GxP Computerized Systems
- ISO/IEC 15415:2011 — Bar code symbol print quality test specification, 2D symbols
- ISO/IEC 15416:2016 — Bar code print quality test specification, linear symbols
- AIAG MSA (Measurement Systems Analysis), 4th ed. — Attribute and Gauge R&R methodology
- FDA — General Principles of Software Validation (2002)
Further reading
- Gage R&RThe measurement-system-analysis method used to qualify a vision station as a valid gauge.
- GAMP 5The risk-based validation framework a vision system is categorized and validated under.
- SPCWhere vision-derived measurements (fill level, dimensions) feed statistical process control.
- CAPAWhere a systemic vision failure — drift, model change, threshold change — escalates.
- Nonconformance vs. DeviationHow a vision reject is classified and routed.
- 21 CFR Part 11The electronic-records framework that governs inspection images and thresholds.
- Audit TrailWhat must be captured when a vision threshold or recipe changes.
- Batch RecordWhere vision inspection results attach as part of the manufacturing record.
- Checkweigher RejectA sibling in-line inspection technology with the same reject/audit-trail requirements.
- Glove Print MonitoringAnother camera-adjacent contamination-control check in aseptic areas.
- AQLThe sampling-plan concept vision inspection often replaces with 100% inspection.
- FMEAThe risk tool used to decide where a vision station belongs in the process.
Want to see how Machine vision inspection could fit into your own records and workflows? Explore the related V5 pages or talk to our team about what applies to your operation.
