Vision, OCR and Barcode Checks for Mixed-Product Line Changeovers
A readable barcode is not a correct barcode. Here is how to combine decoded identity, OCR text and visual appearance checks so a changeover is verified against the approved job record.
Combine vision, OCR and barcode checks by comparing each observation with the approved production job. Verify product identity, label revision, printed lot or date, component type and pack count as separate requirements. Keep no-read, mismatch and missing-job outcomes distinct, and hold affected units until the required checks resolve.
Consider a hypothetical filling line that finishes a run of product ALPHA at shift change. The next job is product BETA: same bottle, same cap, same carton footprint, different formula, different label artwork. The hopper is swapped, the HMI is updated, the line starts. The label applicator still holds the tail end of the ALPHA roll.
Every barcode on those first cartons decodes perfectly. The verification station shows green. The station was asked the wrong question. It was asked "can you read a code?" when the question that matters after a changeover is "does what I observe match the job I was told to run?"
That distinction is the subject of this article. A readable wrong barcode fails. A high-confidence OCR result on the wrong lot code fails. A correct pack count of the wrong component fails. Changeover verification is an identity consistency problem, and identity consistency requires an authoritative job record to compare against.
The Only Reference That Counts Is the Approved Job
Start by writing down what the station is permitted to treat as truth. In a changeover check there is one source of truth: the approved job or recipe record released to the line. Everything else, including the label on the bottle, the code on the carton, the setting on the HMI and the roll in the applicator, is an observation to be tested against that record.
GS1 guidance for 2D codes at retail point of sale separates the product identifier from additional data carried alongside it, and treats barcode print quality verification as distinct from obtaining one successful read [1]. That separation is useful on the plant floor for reasons unrelated to retail checkout. It forces you to name the field you are checking. Are you checking that an item identifier decoded? That it decoded to the identifier assigned to this job? That human-readable lot and date text agrees with the decoded data? Those are three tests with three failure modes. Comparing a decoded identifier and printed human-readable text against authoritative job data is a plant workflow you design, not something the guideline prescribes.
The job record should be pulled, not typed. If an operator can key the expected product identity into the station at changeover, the station will eventually confirm a typo. Pull expected values from the released job, lock them for the duration of the run, and display them on the station screen so the operator can see what the machine believes it is running.
Then define each comparison explicitly. For every field the station needs an expected value, an observed value, a match rule and a defined consequence of mismatch. If that row cannot be written for a field, the field is not ready for an automated check. Keep each automated check tied to a defined requirement and a testable acceptance rule.
| Field | Job truth (expected) | Observed value | Check and owner outcome |
|---|---|---|---|
| Item identity | Identifier assigned to product BETA | Decoded identifier from carton code | Exact match required. Mismatch stops the line; quality owns product disposition |
| Label artwork revision | Artwork revision released with the BETA job | Revision marker read by OCR or template match on label | Exact match required. Affected units held; packaging engineering owns artwork investigation, quality owns release |
| Lot code | Lot NOV-A | OCR text from the date and lot field | Character-level match. Mismatch holds affected units; line lead reprints and re-verifies first-off, quality releases |
| Component type in kit | BETA component, keyed shape | Visual class per cavity | All cavities must match the expected class. Any mismatch rejects the kit; assembly lead owns rework |
| Pack count | Count specified by the BETA job | Counted units per carton | Count must equal expected. Short or over count rejects; packaging lead owns recheck |
| Expected job record | Released job record retrieved | Record retrieved, or not | Missing or ambiguous record holds the station. Supervisor owns restart authorization |
No-Read and Mismatch Are Not the Same Event
One design error worth naming is collapsing two outcomes into a single red light. A no-read means the station could not obtain a value. A mismatch means it obtained a value and the value contradicted job truth. These call for opposite responses.
A no-read can come from imaging or presentation issues: glare on a curved bottle shoulder, a code printed into a seam, a carton rotated past the field of view, a dirty window, drifted focus. Fixing presentation and re-presenting the unit is appropriate, but the affected units stay held until a value is actually obtained and verified. Nothing has been confirmed, so nothing is released. Causes in this family are covered in more depth in the notes on machine vision lighting and surface interaction and on defect size versus camera resolution.
A mismatch is a product control problem. Either something physically wrong is in front of the camera, or the job record is wrong. Stop feeding units, contain everything run since the last verified good check, and route disposition to quality. Wiping a lens does not clear a mismatch.
Report, trend and escalate the two separately. A rising no-read rate is a station health signal. A single mismatch is a containment event.
- No-read means an absent value. Re-present and investigate presentation, and hold the affected units until a verified value exists.
- Mismatch means a contradicted value. Stop, contain, escalate to quality for disposition, and never retry in order to pass.
- Ambiguous identity means two conflicting identifiers were read, or a value outside the allowed set for this job appeared. Treat it as a mismatch, never as a no-read.
- Missing job record means the station has no truth to compare against. Hold the station. This is the fail-closed case.
- Low confidence means the decoder or model is uncertain. Route to human review, and do not auto-pass.
- Unknown image state means the station cannot classify what it saw. Hold the affected units; continued acquisition is acceptable only where containment and unit-level identity tracking are proven, and otherwise stop release.
Confidence Is Not Correctness, and a Decode Is Not Verification
Two beliefs cause trouble. The first is that a high model confidence score means the answer is right. Confidence describes how strongly a model prefers one output. It says nothing about whether the reference data behind the decision was correct for this job. A confident OCR read of "NOV-A" has no value if the released job specifies a different lot.
The second is that a successful barcode read proves the barcode is acceptable. GS1 guidance treats print quality verification as an activity distinct from obtaining a read [1]. A station may decode a symbol that a verifier would grade as marginal, and marginal symbols can fail at a different scanner under different light. If print quality matters to the customer, measure it with the appropriate instrument on a sampling plan rather than inferring it from station pass rates.
Published research on mixed-SKU bottling lines for household chemicals describes a hybrid approach that combines learned region selection with deterministic checks and keeps a per-bottle record [3]. That was a small experimental study rather than evidence about inspection performance generally, but the architecture is worth considering: learned components find and classify, deterministic rules compare against job truth, and the deterministic layer holds veto power.
Measurement discipline matters as well. NIST's validation of upgrades to the M48 vision measurement system relied on long-term check standards and reference materials to show the instrument still behaved as expected [4]. A production camera needs its own measurement validation; laboratory uncertainty figures describe the instrument evaluated in that study. The transferable principle is narrower and still valuable: a station that measures or classifies needs a known reference artifact re-presented on a schedule to demonstrate it still behaves. Setting those limits is covered in the notes on inspection thresholds and validation and on station drift and maintenance signals. Where a dimensional feature such as a cap seating height is in scope, the tolerance must come from the product drawing, and the check may use a validated 2D side view, a 3D sensor or a contact gauge, whichever is validated for that feature. Surface images do not measure electrical continuity or seal strength; use the specified functional test for those. Visible features can support a package integrity conclusion only where a validated correlation to the package-specific reference test has been established.
Hypothetical worked example: the retained label roll
A fictional household chemical line changes from product ALPHA to product BETA. Formula, fill volume and carton code all update correctly from the released job. The label applicator still carries ALPHA label stock, so the first cartons wrap ALPHA-labeled bottles in BETA cartons. A carton-code-only station passes everything, because the carton is correct. A station built on identity consistency fails the first-off: the label artwork revision read from the bottle does not match the revision released with the BETA job, and the on-label product name class does not match the expected class. The station reports a mismatch rather than a no-read. The line stops, affected units are contained, packaging engineering investigates the artwork and stock control, and quality decides disposition and release. The retained first-off record holds the expected revision, the observed revision, the images and the name of the person who authorized the restart. The lesson is placement. A station that inspects only the outer code can only catch outer-code errors.
Acceptance Tests Worth Running Before Trusting the Station
The tests below are recommended plant acceptance tests. They are not requirements from any standard. Each one targets a specific way changeover logic fails.
1. Recipe version interlock. Release a job, then release a revised version of the same job. Confirm the station refuses to run against the superseded version and displays which version it is enforcing. 2. First-off challenge. Present a known-good BETA unit and confirm a pass. Then present a known-bad unit for each named failure mode: wrong label revision, wrong lot text, wrong component class, short count. Each must fail for the correct stated reason, not merely fail. 3. Old job rollback. After switching to BETA, deliberately present ALPHA product. The station must declare a mismatch against the BETA job rather than quietly recognizing ALPHA as a product it knows. 4. Power cycle recovery. Cut power to the station mid-run. On restart it must restore the same enforced job or hold until a supervisor reconfirms. It must never resume with no job loaded. 5. Stale cached recipe. Change the job record upstream while the station is idle, then start. The station must fetch current truth rather than serving a cached copy of the previous job. 6. Fail closed on missing truth. Make the job record unavailable. The station must hold and state why. Any unknown or missing input is a hold, never a pass.
Run these at commissioning, after any change to the job interface, and after any station software change. Keep the signed test record with the station documentation. If a test fails, the resulting maintenance request should begin with diagnosis of the observed behavior rather than a prescribed parts swap, and the finding belongs in a closeout record that stays usable later. The notes on work order closeout data that stays trainable describe what that record needs to contain.
Evidence You Will Want Later
Changeover verification earns its keep during an investigation, which means the record must be readable by someone who was not there. GS1's explanation of EPCIS describes events that capture what, when and where along with business context, with version 2 extending to sensor and status data [2]. GS1's traceability material distinguishes critical tracking events from the key data elements attached to them [5]. Both supply useful vocabulary for designing a local inspection record. Use those questions to define which product, job, station, time and decision each local record must preserve.
The table below is a minimum retained record for every first-off and every reject.
| Record element | Example value | Why it matters | Retention owner |
|---|---|---|---|
| Event type | Changeover first-off | Separates first-off evidence from in-run rejects | Quality records |
| Enforced job and version | Product BETA, released version in force | Proves which truth the station compared against | Quality records |
| Expected versus observed | Expected artwork revision beside observed revision | Preserves the actual comparison, side by side | Quality records |
| Outcome and reason | Mismatch, label artwork revision | Keeps mismatch distinct from no-read in the record | Line lead |
| Image reference | First-off label and carton images | Lets a reviewer re-judge the call later | Engineering |
| Decision and authority | Hold placed; release authorized by named quality representative | Ties the machine event to a human decision | Quality |
| Reference artifact check | Result of the last known-good artifact presentation | Shows the station was proven working near the event | Engineering |
Hypothetical worked example: right count, wrong component
A fictional mixed kit packs five components per tray. During a changeover from the ALPHA kit to the BETA kit, one bin is restocked with the ALPHA variant of a visually similar component. Every tray leaves with exactly five pieces in exactly five cavities. A count-based check passes. A per-cavity class check fails, because the expected component class for the BETA job does not match the observed class in one cavity. The assembly lead owns rework, quality owns disposition of anything already packed, and the record shows which cavity, which expected class, which observed class, and the image. Count and identity are different checks. Satisfying one says nothing about the other.
Frequently asked questions
Does a successful barcode read prove the product is correct?
No. It proves a symbol was decodable. Correctness requires comparing the decoded identifier against the identifier assigned to the released job, and GS1 guidance treats print quality verification as separate from obtaining a read [1].
Should OCR text or the barcode win when they disagree?
Neither. Disagreement between human-readable text and decoded data is itself a failure. Hold the affected units and escalate, because one of the two is wrong and which one is not yet known.
Can the station auto-retry a mismatch?
No. Retrying a mismatch until it passes is a path to shipping wrong product. Retry is appropriate for no-reads, where presentation is the suspected cause, and the units stay held until a verified value exists.
What if the expected job record is unavailable at changeover?
Hold the station and require a supervisor to resolve it. A station with no truth to compare against cannot verify anything.
Is a reference artifact needed if the station only reads codes and text?
Yes, where any part of the decision depends on imaging or measurement. NIST's validation work shows image-based measurement results stay credible through scheduled checks against known standards [4]. Scaled to a plant, that means a known-good unit presented on a schedule with the result retained.
Where to Start
Pick the highest-mix line and write the identity table from the first section for one product pair: expected value, observed value, match rule, owner. A short session with a packaging engineer and a line lead will show how many current checks have no authoritative reference behind them. Resolve any missing expected values before selecting the inspection method.
Then run the old job rollback test by hand. Present the previous product to the current station and watch what it reports. If it passes, or reports a no-read instead of a mismatch, the first fix has been found.
The metric to begin tracking is the split between no-reads and mismatches per changeover. One number describes station health, the other describes product control, and reporting them as a single figure teaches nothing about either. Method selection is covered in the notes on rule-based versus learned inspection methods and station layout in the notes on quality inspection station design; the platform view of how these checks connect to line and asset monitoring sits on the computer vision page, and a specific changeover case can be discussed there.
Return to the label applicator with the leftover roll. That failure was not difficult to catch. It was invisible because nobody had written down what the line was supposed to be running in a form the station could compare against.
References
[1] "2D Barcodes at Retail Point-of-Sale Implementation Guideline". https://ref.gs1.org/guidelines/2d-in-retail/1.1.0/
[2] "What is Electronic Product Code Information Services (EPCIS)?". https://support.gs1.org/support/solutions/articles/43000755325-what-is-electronic-product-code-information-services-epcis-
[3] "Vision-based automated optical inspection for real-time quality control: hybrid single-camera deep-learning AOI for mixed-SKU bottling lines". https://link.springer.com/article/10.1007/s00170-026-18704-3
[4] "Validation of upgrades to the NIST M48 vision measurement system". https://www.nist.gov/publications/validation-upgrades-nist-m48-vision-measurement-system
[5] "What is the GS1 Traceability Standard?". https://support.gs1.org/support/solutions/articles/43000734535-what-is-the-gs1-traceability-standard-
Related articles
Ready to put this into practice?
See how Monitory helps manufacturing teams implement these strategies.