Defect detection on the line: where manual control breaks down
On the line, manual quality control relies on human attention, and it is not constant. An inspector looks at a product for seconds; thousands of units pass through a position per shift — and in the last hours, the defect escape rate is higher than at the beginning.
The line pace does not allow returning to a questionable item: while it is being re-examined, the next ones have already passed inspection on the conveyor.
A separate group is defects that the eye reliably catches only under ideal conditions: microcracks under the coating, scuffs on gloss and polish, color mismatch, underfilling, glue traces along the edge.
They are visible under one angle of light and invisible under another, while static illumination and glare cause false triggers where there is no defect. Here manual inspection ceases to be reliable even for an experienced inspector.
Plus, assessment variability: the boundary between "acceptable or defect" is different for everyone, and it shifts toward the end of the shift.
The same defect gets different verdicts from different people and from the same person at different times — meaning there is no reproducible reference, and there is nothing to settle a dispute with a supplier or customer.
The cost of such a bottleneck on the line is not only rejected items. A missed defect goes into assembly or to the customer, the entire batch is re-sorted, and sometimes the conveyor is stopped to find the cause.
We will break down how this is addressed: which defect detection in manufacturing removes shift fatigue, pace, and subjectivity of assessment, and what remains with the human.
Automated quality control: what changes in manufacturing
Automated quality control shifts defect assessment from sampling inspection to every unit of production. A camera and model on the line produce a decision at conveyor pace, and the operator only handles disputed cases flagged.
We train and retrain models on PyTorch — an open stack, so the customer is not tied to a single vendor and can maintain the solution on their own.
The main metrics here are not "accuracy in general" but the defect escape rate and the false positive rate — they pull in opposite directions.
If we shift the confidence threshold, sensitivity to defects increases, but so does the number of false line stops; we tune it according to the cost of error in a specific area.
The threshold is hardcoded in the model version configuration, so the result is reproducible from run to run.
Stability of rejection is primarily the variability of assessment between shifts. In humans, discrepancy in disputed categories reaches tens of percent; for the model, the output is deterministic with one version of weights, unchanged lighting calibration and shooting geometry.
Therefore, the loop includes drift monitoring: regular comparison with a reference sample and an alert if metrics drop.
Inspection time per unit stops depending on shift load and human pace, and a reduction in returns becomes a consequence of consistent shipment quality. We separately calculate what share of disputed cases the human takes — if it does not decrease, we continue tuning.
Operating modes of a defect detection system: comparison of approaches
The mode is chosen not by model accuracy, but by scene stability and the variability of the defect itself.
If the part is always in the same position and the defect is described by geometry, rule-based control works; if the defect "floats" in shape and color — training on labeled data.
| Option | When it fits | Limitations |
|---|---|---|
| Rule-based control | Fixed part position, defect described by thresholds on area and geometry | Breaks when the material batch or lighting changes; some defects cannot be formalized |
| Training on labeled data | Defect is variable, classes are known, there is a stream of frames for labeling | Requires a representative sample and retraining when the product changes; rare classes cause escapes |
| Hybrid control mode | Part of defects is formalizable, part is not; low false positive rate is important | Two logic branches, more complex support and end-to-end labeling of decisions |
Rule-based control provides a reproducible solution: it is built with classical image processing algorithms (OpenCV) and explained to the inspector; debugging takes hours.
The limitation is fragility: a change in lighting or raw material batch requires revising thresholds, and fine scratches do not fit into rules.
Training on labeled data covers variable defects, but is tied to the sample: a rare class is represented by single examples, and escapes grow on it.
Hybrid control mode resolves this contradiction — rules cut off obviously good items, the model handles disputed ones, and false line stops become fewer.
How implementation proceeds: stages of engineering work on the line
Implementation starts not with the model, but with the area. During the audit, we record the line pace, product range, shooting zones, nature of lighting and interference, as well as how defects are currently rejected.
If this step is skipped, the solution runs into the reality of the line: insufficient exposure, the camera looks past the defect zone, the operator cannot react in time.
- Area audit. We capture the actual state: conveyor speed, vibrations, illumination fluctuations, available mounting locations for cameras and light.
- Control scheme. We agree on the list of defect classes, the "acceptable / defect" boundary, and the rejection point — before or after the process operation. For each class, we determine what to do with a disputed case.
- Sample collection and labeling. We gather frames from real batches, including rare defects, label them, and fix the detection rate and false positive rate before work starts.
- Camera and light calibration. We set up geometry, exposure, and illumination so that defect contrast is stable when the batch changes. Tooling is fixed so that position does not drift during maintenance.
- Training and threshold tuning. We select sensitivity for each class separately: defect escape and false rejection cost differently, so thresholds are set according to line requirements.
- Acceptance on a test batch. We run the system on a batch with pre-known labeling, compare results by class, and confirm that metrics match the declared ones.
- Handover to operation. We formalize the procedure, train operators, and show how the system keeps a log and updates when new product range appears.
Each stage ends with a verifiable result: a scheme, a set of labeled frames, a report on the test batch. This way, the output is not a demonstration, but a working control loop with clear operating rules.
Schemes, configurations, and regulations for quality control
After commissioning, the enterprise retains not only a working system but also a set of documents according to which it is operated, maintained, and handed over between shifts.
Without it, the installation becomes a black box: the operator does not know what to do with a borderline frame, and the new shift does not know how to restart the flow after a stop. Below is what we hand over together with the system.
- Camera and lighting layout: binding to line positions, zones of interest, tolerances for displacement and overlap of adjacent areas.
- Threshold settings for each defect type — with a note on which values are confirmed on the acceptance frame set.
- Access policies: roles of operator, adjuster, and process engineer, boundaries of what each can view, change, and confirm.
- Operator response procedure: confirm a defect, send for recheck, stop the line, whom to notify and within what timeframe.
- Maintenance instructions: cleaning optics, checking focus and camera position, running control samples, actions on frame capture failure.
- Model update procedure: how labeling is accumulated, on which set a new version is tested, who approves and how to roll back to the previous one.
- Log of settings and model weight changes, linked to versions — so that in six months it is clear why the threshold is set exactly that way.
Case study: how defect escape was reduced on a bottling line
On the bottling line, fill level, cap tightness, and label alignment were controlled.
Before implementation, inspection was sampling-based: the operator took a few bottles per shift, so defects went into the pallet and surfaced already at the distributor — quality feedback came with a delay of a day.
Shooting was set up at three positions — after filling, after capping, and at the exit.
Lighting is synchronized with the line sensor so that glare on glass and a wet cap are not read as a defect, and the model runs locally at the line on ONNX Runtime — the camera stream does not depend on the communication channel.
| Metric | Before | After |
|---|---|---|
| Defect escape | 4.2% | 0.6% |
| False positives | 7 per 1000 bottles | 1.1 per 1000 |
| Changeover when switching products | about 40 minutes | 6–8 minutes |
False positives turned out to be the main cost of error: each extra one is a stop and manual recheck.
The confidence threshold was selected separately for each defect class, and the decision is made on a sliding window of frames, not a single one — jitter on droplets and glare was eliminated.
Changeover previously required manual adjustment of zones and references; now the operator selects the article and checks the reference frame — downtime decreased almost sixfold.
Each trigger is saved with a slice of frames; once a week the model is retrained on accumulated data, so rare defects gradually stop slipping through: the reduction in defect escape is sustained, not achieved once at acceptance.
How rule-based control differs from training on labeled data
Threshold features are a measurable formula: spot area, contrast to background, deviation of geometry from reference.
As long as the defect consistently differs from the background and lighting and part position do not change, the rule provides predictable accuracy and does not require defect labeling. It is set up within a shift on real shop-floor frames.
The threshold breaks where the feature ceases to be constant. Scuffing, uneven texture, a grease trace or glare on a seam are not described by a single formula — the rule starts either to miss defects or to stop the line on a good part. Changing the material batch adds the same problem.
Training on labeled data takes on what cannot be written as a formula. Defect labeling becomes the main investment: boundaries between similar classes — a scratch and a grinding mark — have to be agreed between labelers, and disputed frames have to be set aside separately.
In return comes robustness to background and material variations and the ability to catch a defect by a combination of weak features.
New defect types are a key argument. A threshold rule will not see them until someone re-describes the formula; an anomaly model will highlight a deviation, but confident detection requires retraining the model on dozens of labeled examples.
After retraining, we check that previously mastered classes have not degraded — a control set across all classes, not just the new one.
The choice of approach is rarely binary: thresholds remain the first filter on coarse and stable features, the model works on the rest of the stream.
The criterion is simple — how stable the feature is between batches and what is cheaper in operation: reconfiguring a rule or a labeling and retraining cycle.
Technical doubts before launch: frequently asked questions
Process engineers and engineers ask almost the same questions before launch — about model behavior in operation, not about accuracy on demonstration frames.
Below are short answers to what most often decides the fate of a launch: false positives, a new product batch, lighting changes, and model support after handover to the shop.
How many false positives will there be and who handles them?
We select the threshold based on the error curve on a holdout set: it shows how many defects we miss at a chosen false alarm rate. Then we compare the cost of a miss and the cost of manual recheck — at this boundary we choose the operating mode.
For the first weeks we go with increased sensitivity, then refine the threshold based on accumulated labeling.
What happens with a new product batch or a change in lighting?
The model relies on features that persist across batches, but a change in raw material supplier, coating shade, or illumination scheme shifts the data — accuracy drops.
Therefore, the project includes a robustness check: frames from different shifts and batches, drift monitoring, and a retraining procedure. Constantly changing lighting is fixed as part of the process — camera position and illumination parameters.
Who supports the model after implementation?
Support is not only reacting to a failure. We hand over a procedure: how to replenish the frame set, how to retrain on new labeling, how to roll back the model to a previous version if accuracy drops.
We structure the implementation in stages so that the first line runs on a limited area, and expansion proceeds as data accumulates.
Let's discuss the task: we'll analyze the line and come back with a plan
We can assess the area using your own data from the line — without a site visit and before any work. Send what you already have: camera recordings, defect statistics, a diagram of the control zone.
This is enough to understand what accuracy is achievable, where additions to lighting and optics are needed, and to come back with an estimate and a plan.
- Video or photos from the line: good products and all occurring defect types — captured with the same cameras and under the same light as will be used in operation. The more real frames, the more accurate the assessment.
- List of defects with priority: what must be caught, what is acceptable to miss, and which error class is more expensive — a missed defect or a false positive.
- Shooting conditions and installation location: line speed, cycle time, control zone, lighting, vibrations, where the camera physically goes and how the product is diverted.
- Defect data per shift or month: share of defective products, distribution by type, who currently makes the decision and by what rule.
- How the result should proceed further: signal to operator, product diversion, marking, entry into the area's accounting system, shift report.
- Site constraints: access to the line and network, installation windows, safety requirements, who on the customer side confirms the reference labeling.
From this we assemble a plan: first a pilot on one line with accuracy measurement on your sample, then expansion to other areas. Describe the task — we will come back with an estimate, package composition, and boundaries of responsibility.







