Industries · 7 min read
Lot code and expiry date verification with vision AI before the pouch moves on
The strip found on every pouch wherever the film pulled it, the crop read, format and date logic checked, and a failed read stopping the pouch, not guessing.
Summary
This post walks a pouch past the camera on a form-fill-seal line, where a detector finds the lot and expiry strip wherever the film pulled it, the crop is read, and two checks run on the reading before the pouch is allowed on. It concludes that a failed read has to stop the pouch, that glare on the film and a cold print head are the review queue, and that a new label layout is labeled from the line's own frames. It is for flexible packaging and quality teams.
Stephen Biswas · Engineer · Sep 26, 2026

Cartons passing a scanner on a packaging line, carton and conveyor boxed, generated scene with detections from our model
The form-fill-seal machine on line 6 makes a pouch every second or so from a roll of film, and a thermal transfer coder prints the lot and the expiry onto the seal area as the film passes. The print is small, it is on a surface that flexes, and it lands wherever the film happened to be when the head fired. An operator pulls a pouch every few minutes and reads it. Between pulls, a coder whose ribbon has creased prints half a lot code on every pouch, and nobody knows until the pull.
A camera at the outfeed sees every pouch. The job it is given has four parts, and the plant's trust in it depends on the last one, which is what happens when a read fails.
Vision AI on the pouch line is a detector, a reader and two checks
The tidy way to think about the line 6 station is as four steps in a row. A detector finds the strip of print on the seal. A reader turns the crop inside the box into a string. A format check asks whether the string is shaped like a lot and an expiry at all. A logic check asks whether the lot is the one the order expects and the expiry is a real date inside the product's shelf life. That is the whole of what vision AI does at the outfeed, and each step should be visible on its own, so the line lead can see which one stopped a pouch.
The package and label inspection use case describes the general shape, a region and a rule, and names line speed as the hard part. On a pouch line the frame is motion-blurred, the seal area is curved where the jaws pressed it, and the time between pouches is the time the four steps have.
The strip is found on every pouch, wherever the film pulled it
The print on line 6 is never in the same place twice. The film stretches, the registration mark drifts through the roll, and a pouch at the start of a roll has its lot near the top of the seal while one at the end has it near the edge. A fixed crop would read most of the roll and miss its ends. So the first model is a detector with one class, the lot and expiry strip, and it puts a box on the print wherever it landed.
The frames come from the outfeed camera at speed, with the jaw marks and the glare stripe from the overhead lamp where they actually are. You type "lot and expiry strip" once, Lexi proposes the box on every pouch, and a person checks them. The checker's time goes on the pouches where the strip runs into the seal's edge, which is where the detector's box has to be tight or the reader gets half a code.
The crop is read, and then the format and the date logic are checked
The reader's output is a string, and the string on its own is never the verdict. The format check is the plant's own: a lot is a letter for the line, a letter for the shift and a run of digits, and an expiry is a day and a month and a year in the plant's order. A string that does not fit is a misread or a coder fault. The logic check is the order. The lot has to be this shift's lot for line 6, and the expiry has to be after today and inside the shelf life. A reading that passes the format and fails the logic is the creased ribbon printing something plausible.
Most of the reader's mistakes are caught here and none of them needed a new label. My own view is that the reader, the format check and the logic check should each write their own line in the record for every pouch. A plant that only sees "held" cannot tell a smeared print from a wrong order, and those have different fixes.
A failed read stops the pouch rather than guessing
A pouch whose strip could not be found is held. A pouch whose reading fails the format is held. A pouch whose lot is not this shift's is held. None of them is waved on because the coder is probably right, and the reject gate after the outfeed takes the pouch out before the case packer.
The hold is an alert, a rule written as a sentence, with a severity and a cooldown, approved before it goes live. A lot on line 6 that disagrees with the order is critical and goes to a webhook the line controller reads and to the line lead's phone, with the frame and the crop. A strip that could not be read is routine and goes to the same lead's list, and three of those in a row is the ribbon. The monitoring and alerts doc covers how each of those paths is wired. With a runner beside the recorder the hold is raised at the gate, and the footage stays on the line.
Thermal transfer prints sharper on warm film, so the first pouches after a stop are always the worst ones to read.
Glare on the film and a cold print head are the review queue
A pouch whose seal caught the lamp's reflection across the strip. A pouch from the first minute after a stop with a faint print from a cold head. A pouch where the film creased under the jaws and folded a digit. These are the ones the model doubts, and it should say so. The frame goes to the line lead with the box and the reading, she confirms or corrects it, and her call is recorded against the frame.
LexData takes the outfeed model through its whole life. You type what to look for, Lexi puts a box on the strip on every pouch on every frame, and a person checks each label before anything trains on it. The model then watches the outfeed camera on line 6, in the cloud, on your servers, or on a runner beside the recorder. Frames it is unsure of come back to a person, the corrections retrain it, and the new version replaces the old one with no downtime. The 99%+ accuracy maintained in production that our manufacturing work reports is held by those corrections, which on a pouch line mostly arrive in the first minute after a stop.
A new label layout is labeled from the line's own frames
The artwork changes in the spring and the lot and expiry move from the seal area to a printed panel on the front of the pouch. Every pouch is correct on the changeover day, and the detector is looking at a seal that no longer has a strip on it. The drift catalog calls this a spec change: the footage did not move, and what the model was taught to find is no longer where it was.
The changeover date is known months ahead. Frames of the new artwork from the line 6 camera, a window of them labeled, the format check rewritten if the layout changed the order of the fields, and the model retrained before the run. Versions keep what they were trained on, so the old artwork still verifies on the roll the plant is finishing. The pull every few minutes still happens, and the operator now spends it on the pouches the camera held rather than on the ones it had no reason to doubt.
See it on your own footage.
Start with your footageMore in Industries

Industries · 6 min read
AI crop analysis in the greenhouse, catching tomato disease before it spreads down the row
Lesions boxed by disease with a healthy class, a question of the footage about how far a patch spread since last week, and a model that turns with the season.
Rob Hickey · Sep 26, 2026

Industries · 6 min read
Ceramic defect detection for hairline cracks a fixed-rule camera cannot learn
Edge chips, hairline cracks and pinholes on the tile line after the kiln, masks where the area sets the grade, and the new glaze as the day to relabel.
Esdras Ntuyenabo · Sep 26, 2026

Industries · 6 min read
Chocolate box inspection with a camera over the tray line
Each piece boxed by type, a plain check against the box template, damage as its own class, and the new spring assortment as the day the labels go stale.
Stephen Biswas · Sep 26, 2026