Industries · 6 min read
Computer vision pill inspection catches one damaged tablet in a thousand
A camera over the tablet conveyor before the blister packer, recall set on the defect side, and thresholds re-tuned when a new batch moves the base rate.
Summary
This post describes a camera over a tablet conveyor just before the blister packer, where chipped, cracked and foreign-matter tablets are rare enough that overall accuracy says nothing. It concludes that recall on the defect classes is the number to set and defend, that the reject has to land inside the packer's cycle window, and that a new batch moving the base rate is a threshold finding before it is a model finding. It is written for QA and validation engineers on solid-dose lines.
Rob Hickey · Chief AI Officer · Sep 24, 2026

Packaging line past a scanner, generated scene with detections from our model
The tablet conveyor on line 3 carries white, round, unscored tablets from the coater to the blister packer at a rate the packer sets, and the camera over it sees each tablet for about a third of a second. On a good batch, roughly one tablet in a thousand is damaged: a chipped edge from the coating pan, a crack across the face from a hard press, or a speck of something that is not tablet. On a bad batch it is one in two hundred. The QA lead keeps every foreign-matter find in a small jar on a shelf in the office, labelled by date, and the jar from March has three things in it.
Three in a month is the whole positive class.
One damaged tablet in a thousand makes accuracy useless
A model that calls every tablet good is right on all but one tablet in a thousand on line 3, and catches nothing. The overall accuracy figure is dominated by the good tablets and says nothing about the question the line is asking, which is whether the damaged ones were found. The surface defect detection use case carries the same imbalance for scratches on metal, and both places need the same discipline: measure each defect class on its own, and measure recall first.
The rare classes also set the labeling schedule. Ten thousand frames of good tablets are labeled in an afternoon and teach the model almost nothing new after the first thousand. The three finds in the March jar, plus every chipped tablet the coater has produced since the camera went up, are what the model learns damage from, and each one is kept in the set on purpose.
Object detection boxes the chip, the crack and the speck
A pass or fail on the whole frame is not enough on a conveyor carrying a dozen tablets at once, because the reject has to know which tablet. The task is object detection: a box on each tablet, and inside the damaged ones a class, chipped, cracked or foreign matter. The box sits on the damage itself, so a person reviewing the frame at 2 am sees where the chip is and can tell a chip from a shadow off the conveyor edge.
The classes are typed once. Lexi proposes the boxes, and the QA technician who fills the jar checks each one before anything trains, with most of the checking spent on the boundary between a chipped edge and a tablet that is merely turned so the light catches the bevel. That boundary is where the model will be uncertain, and the labels have to be certain there or nothing downstream is.
Recall favours the defect side and false rejects are counted
Every threshold on line 3 is a trade between a damaged tablet reaching a blister and a good tablet going to the reject bin. The two costs are nowhere near equal, and the threshold should say so: slow to call a tablet good, quick to send a doubtful one out of the stream.
My view is that a QA engineer should be ready to defend a reject bin with good tablets in it and should never be asked to defend a chipped tablet in a blister. The cost of the bin is counted every shift and is small. The cost of the blister arrives months later as a complaint or a recall, and it is not small. So the recall target is set per defect class, checked against a held-out set that contains every rare find, and the false reject rate is reported beside it rather than hidden inside an accuracy figure.
The reject signal has to land inside the cycle window
The camera sees a tablet for a third of a second and the reject gate is a short distance downstream. The decision has to leave the model, reach the line controller, and fire the air jet before the tablet passes the gate, every time, on frames blurred by the conveyor's motion. A reject that arrives late is a good tablet blown off the belt and a bad one already in the blister.
That is a rule with a severity and a cooldown, written as a sentence and approved before it goes live: a chipped, cracked or foreign-matter tablet in the stream, critical, the gate fired and the frame logged to the batch. Manufacturing inspection run this way holds 99%+ accuracy in production, and on a solid-dose line the log with the frames is what the batch record needs at release.
A new batch moves the base rate and every threshold
In May a new coating lot goes onto line 3 and the chipped rate doubles for a week. Nothing about the model is wrong; the chips are real, the boxes are on them, and the reject bin fills faster. The trouble comes the other way. Once the coater is adjusted and the chip rate drops below what it was before, the threshold that was tuned in March starts sending doubtful tablets to review at a rate nobody expected. The review queue floods with tablets that turn out to be fine.
The drift catalog calls this the defect rate changed, and it is the condition most often mistaken for a model problem. Per-tablet, the model is as good as it was. The base rate moved, and every threshold tuned around the old rate moved with it. The fix is to re-tune the thresholds against the current batch before anyone retrains, and to read the alert volume against its own history, because a queue that floods or falls silent is the cheapest signal there is.
Doubted tablets come back and the rare class grows
The tablets the model cannot decide on, the bevel catching the light, the speck that might be coating dust, come back to the QA technician with the frame. The verdict is a label. The March jar grows one entry at a time, and so does the training set for the class nobody can manufacture on demand.
LexData takes the line 3 model through its whole life. You type what to look for, Lexi puts a box on every frame, and a person checks each label before anything trains on it. The model then watches the conveyor camera, 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 doubted frames are the only place a class that appears three times a month can come from, and the review queue is where the second version's recall on foreign matter was earned.
See it on your own footage.
Start with your footageMore in Industries

Industries · 6 min read
AI visual inspection as the nondestructive testing step a camera can take over
Visual testing is the first NDT gate, its acceptance criteria are already written, and a camera can apply them to every weld instead of one in twenty.
Rob Hickey · Sep 24, 2026

Industries · 6 min read
Appearance inspection systems that judge scratches, chips and burrs the same way on every shift
The station, the light and the written standard matter more than the model. The outlines carry the limit, and a tightened tolerance makes every label wrong.
Rajiya Sultana · Sep 24, 2026

Industries · 7 min read
Automated pallet accounting from the camera over the staging zone
A polygon on the frame, every pallet tracked so it is counted once, entries and exits as the ledger, and a wash-down that nudges the camera as the failure.
Andreas Ohrvall · Sep 24, 2026