Defect detection on the line: where misses and false positives come from
Quality control on the line rests on three things: lighting, angle, and the trigger threshold. Move a lamp by a centimeter or change a batch of material, and the brightness distribution shifts—and with it, the boundary between normal and defect drifts.
An operator compensates by eye, a model does not: it sees exactly what it was taught, and against a new background it confuses a glare with a scratch.
A missed defect and a false positive are two sides of the same setting. Lower the threshold, and the line stops at every shadow while good parts go to reject. Raise it, and a hair-width crack slips through and the batch goes to the customer.
The cost of these outcomes is asymmetric, so an averaged threshold always loses. The metrics are calculated separately: the share of missed defects and the number of false positives per thousand frames are different numbers, and one adjustment knob cannot reconcile them.
A separate problem is the spread in operators' assessments. Two people looking at the same frame give different verdicts, and labeling based on their conclusions teaches the model contradictions.
Until the defect criterion is fixed in writing, damage detection reproduces not the manufacturing tolerance but the habits of a particular shift.
We break down how this is closed: what we fix in optics and setup, how we assemble labeling, and where we set thresholds.
What changes after implementing a quality control system
Quality control stops depending on the attentiveness of a particular shift.
The system inspects every part using one set of features—crack, dent, scratch, gouge—and returns a decision with a confidence score instead of “seems fine.” The share of missed defects at output drops severalfold: what used to go to the customer and come back as a claim is now rejected on the line.
Inspectors are unburdened: the routine sorting of good parts is taken off the human, leaving them with disputed cases—where model confidence is low or the defect is at the tolerance boundary.
Usually this is a few percent of the batch, so the shift can both inspect the flow faster and examine complex parts calmly.
Repeatability of assessment is the second effect. One sensitivity threshold, one set of rules, and a protocol for every decision: when handling a claim, you can see what the system showed and why.
Assessments stop diverging between shifts and sites, and batch inspection speed increases without stopping the line.
The image archive of batches remains a working tool: for any disputed case, the original frames linked to the batch, time, and station are retrieved.
The model is supplied in the open ONNX format and runs on existing equipment, while new defect types are added by retraining on your own archive.
Organizing damage detection: line, sorting station, sampling
The control point is chosen before the model metrics: it determines the requirements for inference latency, lighting stability, and who makes the final decision on a disputed item.
Below are the options that production facilities actually choose between; they are not mutually exclusive, but each imposes its own limitation on output volume.
| Option | When it fits | Mode limitations |
|---|---|---|
| In-line inspection | Mass production with a set takt time, defect is distinguishable on the outer side of the item | Decision is needed before cutoff—disputed frames lead to false positives; changing the product range requires relabeling and retraining |
| Sorting station | Complex geometry, glare, mirrored surfaces, fine scratches | Throughput is limited by the number of operators; quality feedback arrives with a delay |
| Sampling inspection | Expensive or destructive testing, rare defects | A systematic defect passes between samples: the entire batch goes to the consumer |
| Line + escalation to a station | Both pace and accuracy are needed on disputed classes | Requires labeling of model confidence and a rule for what counts as a disputed case |
Mixed mode
In practice, it most often works like this: obvious rejects and clearly good products are separated on the line, while the borderline share of frames goes to a sorting station with a model hint.
This removes the main limitation of sampling inspection—the probability of a miss shifts toward zero, because what is checked is not a random sample but every doubtful case.
The station's throughput is calculated from the actual share of disputed frames, not the entire output volume—and that figure determines whether one operator per shift is enough.
Implementation stages: from site audit to handover for operation
The order of work here is determined not by the contractor's convenience but by the cost of an error at each step: the wrong capture area nullifies labeling, while sloppy thresholds produce a stream of false positives after which the operator stops trusting the system.
That is why implementation proceeds sequentially—from site survey to handover—and each stage has a measurable criterion for moving on.
- Site audit. We look at how the part enters the frame, what illuminates it and at what angle, how the line behaves at different speeds, which defect classes actually occur, and which of them are rejected. The output is a camera placement diagram and an agreed list of classes: cracks, dents, scratches, and separately “background,” so the model does not look for a defect where none exists.
- Capture setup and frame requirements. We fix the angle, field of view, and stability of the part's position. We verify that the minimum significant defect is distinguishable in the image under the worst working lighting conditions—otherwise neither labeling nor training will make it detectable.
- Sample labeling. We label frames by class, separately mark disputed and borderline cases, and supplement rare defects that appear only in ones and twos in the flow. Some frames are labeled twice—discrepancies are reviewed manually, which is cheaper than retraining on contradictory data.
- Threshold tuning. For each class, we select the trigger threshold based on which is more expensive: a missed defect or an extra stop. We tune critical classes for high recall and cosmetic ones for a low false-alarm rate.
- Validation on holdout batches. We run the system on batches from another shift, under different lighting, and after equipment adjustment—ones that were not part of training. We look not at individual frames but at stability across the series: how many parts passed without operator intervention.
- Handover for operation. We provide configurations and the diagram, the procedure for operator response to a trigger, and instructions for updating the model when new defects appear. We train the shift and fix control points that show when the system is degrading.
From there, the site operates under this procedure: trigger logs accumulate, disputed frames return to labeling, and the model is updated on the real flow without stopping production.
Delivery package: configurations, procedures, and documentation
We deliver the system not as a working rig that depends on our support, but as a package your team can live with on its own. Below is what physically remains with the customer, in what form, and what each artifact is for.
- Detector configurations — sensitivity thresholds separately for cracks, dents, and scratches, regions of interest for each camera, and false-positive suppression rules. They are stored in your code repository, changes go through review, so edits are not lost and you can always roll back to the previous version.
- Placement diagrams — mapping of cameras to line sections and inspection zones, angles, lighting layouts, and overlaps with neighboring equipment. The document is needed so that after replacing a camera or moving a unit, the configuration can be restored precisely rather than by trial and error.
- Response procedure — a step-by-step description of operator actions on a trigger: when the flow stops, how the part is marked, who is notified, and within what timeframe. With role assignments, so the decision does not depend on one person.
- Trigger log — structured records with a timestamp, defect type, confidence score, and attached frame. It serves for reviewing disputed cases and as a source of examples for periodic model retraining.
- Instructions and personnel training — separate materials for operators and for engineers who adjust thresholds and zones. Training ends with a test on sample cases, not a formal briefing.
- Maintenance guide — what to check after replacing a camera, changing lighting, or changing the line mode, and which metrics to review regularly: the share of missed defects and the share of false positives.
- Acceptance protocol — an agreed set of reference samples and the results recorded on them. You use it to accept the system and later to check whether it has degraded.
We transfer the entire package into your storage and repositories—without lock-in to us and without proprietary formats. Describe your site and defect types, and we will come back with an estimate and work plan.
Case study: cast part inspection on a conveyor, metrics before and after
In the foundry area, castings were inspected visually: an inspector under a lamp looked for cracks, dents, and scratches and manually wrote the result in a log.
Shift sensitivity fluctuated, hairline cracks at the edge slipped through, and disputed parts went to reject or to good almost at random. The customer return rate did not decrease, and the log made it impossible to understand at which step quality was being lost.
What was changed
The camera was installed at the conveyor exit, and the detection model was trained on labeling of real castings—labeling and training were built on PyTorch. The frame is linked to the part number, so every decision is stored together with the image and confidence score.
We separately described escalation rules: if confidence is below the threshold or the defect falls into a disputed zone, the part goes to an operator for recheck rather than to automatic reject.
Metrics before and after
- Missed defects at acceptance: 12% → 2%
- Customer return rate: 3.1% → 0.6%
- Decision consistency between shifts: 74% → 96%
- Share of parts reaching manual recheck: 100% → 8%
Reviewing disputed cases
Disputed frames are reviewed once a week together with process engineers: zones are refined in labeling, the threshold is revisited, and agreed decisions become the reference.
It was this review that removed most false positives on flash and gate marks—the most common reasons such automation is usually switched off in this kind of area.
What to do if a machine vision system is already running at the site
An already deployed machine vision setup is not something to tear down but a starting asset: working camera positions, selected lighting, a tuned frame flow. The main thing in it is not the model but the labeling: marked defects, disputed cases, and operator decisions on them. Rebuilding that from scratch takes longer than training a new model.
Work starts with an inventory: which defect classes are set up, in what format labeling is stored, on which frames the system errs, and how those errors are recorded.
Transferring labeling into a new setup is the most expensive part, and it is almost always automated: class matching, duplicate detection, and catching contradictions between labels from different shifts. Without such reconciliation, the new model inherits others' mistakes and learns from them as well.
Next is a comparison of approaches. First: keep the existing setup and replace only the model, preserving the entire capture and output pipeline.
Second: run the new system in parallel in shadow mode, where it labels the same frames, and discrepancies with the old detector and the operator are reviewed manually.
Third: a hybrid, where the new model covers classes with poor recall while the old one remains on well-established ones.
The choice is made not on the principle of “newer means better” but by metrics: for which defect class recall increases at the same false-positive rate, and what happens to rare classes.
Integration with an already deployed system does not touch the decision point on day one—thresholds and rejection logic remain the same, and only the source of predictions changes.
Rollback is built in advance: the previous model remains in the package and is enabled with a switch, while labeling and decision history are stored in a single format. This way, the transition to new damage detection does not put current output at risk.
Common doubts before launch: labeling, thresholds, integration
Doubts before starting are almost always the same: will there be enough labeled frames, what to do with defects at the threshold boundary, and will the line have to be stopped for installation. Below are engineers' answers to what most often comes up before work even begins.
Lighting at the site changes during a shift—will detection make mistakes?
What changes is not so much the lighting as the contrast: glare from a lamp and shadow from the conveyor produce a different shade on the same type of crack.
That is why we install the camera with a diffuser and capture the training set in the morning, afternoon, and evening—otherwise the system learns the lighting, not the damage.
How many frames need to be labeled for the system to work?
A guideline is several hundred examples per defect class, including borderline ones. We count not the total labeling volume but coverage of rare classes: if there are few dents or chips in the set, they simply will not enter detection, no matter how many frames are added.
A scratch at the threshold boundary causes false positives—how is that fixed?
We separate thresholds by the cost of error: a missed defect and a false rejection cost differently, so their thresholds differ.
Disputed cases go to additional labeling by an operator, and after a few shifts the boundary follows the site's actual data rather than our assumptions.
Changed supplier or batch—will the system drift?
If the texture, shade, or stamping changes, the frame distribution shifts. That is why we keep a control sample and revisit it after a batch change: retraining on new examples takes less time than relaunching the project.
Will installation require stopping the line?
No. Mounting hardware, lights, and cable runs are installed during planned maintenance or shift change, and the camera is adjusted while the conveyor is running.
Commissioning takes place on the real flow without stopping; downtime is needed only where the site itself requires a pause for threshold calibration.
Let's discuss your task: we'll select an inspection mode for your site
To make the estimate specific rather than an “market average,” we build the first conversation around your site and inspection requirements. Below is what we need to clarify in order to come back with an implementation plan, timeline estimate, and pilot proposal.
- Defect classes and sensitivity threshold. What we consider a crack and what is an acceptable casting or machining mark—both labeling and the acceptance metric depend on this boundary.
- Capture conditions. Lighting, angle, part movement speed, vibration, and camera mounting stability: different tasks are solved on a moving belt and on a test rig.
- Decision point. Where the output is located—at the operator's station or in the overall quality control system—and what happens on a trigger: signal, stop, log entry.
- Data. Whether there is an image archive and labeling, who at the production site confirms a defect, and how often the sample is replenished.
- Pilot acceptance criteria. The share of missed defects and false positives on good products, and response time—we fix these before launch, not after.
- Documentation handover. Operator instructions, the retraining procedure for new batches, and a description of data exchange with the site's accounting systems.
Based on the review, we send a camera placement diagram, the scope of work by stage, and the checks we consider mandatory before commissioning. Describe your task—we will come back with an estimate and plan.







