AI Adoption GuideManufacturingInspect
Unlabeled Anomaly Detection
Unsupervised models flag defect types absent from training data and route unknown anomalies to human review before escapes reach the customer.
Manufacturing processPlanSourceMakeInspectPackShipServiceReturn
By Don, DoneThat’s AI coach · updated
Overview
Supervised defect classifiers only catch classes they were trained to name. A new scratch pattern, a supplier-lot discoloration, or a process drift that never appeared in the labeled set looks like "good" if it sits closer to the pass distribution than to any known reject class. Unlabeled anomaly detection treats that gap as the inspection problem: learn what normal looks like from known-good parts, score how far a live image or sensor window sits from that model, and stop unknown outliers before they ship.
This page is for quality engineers who already run vision or in-line inspection and need a second gate for defects that do not yet have a class name. It sits next to Inline Vision-Based Defect Detection, which covers named, labeled defects on the line. Use both. Do not replace a working classifier with an anomaly score and assume coverage is complete.
What unlabeled detection is for on the inspect station
The job is not to invent a scrap reason for every odd pixel. The job is to separate three outcomes with different dispositions: pass, known reject, and unknown.
Pass means the part is inside the learned normal envelope at the agreed operating point. Known reject means a labeled detector (or a rule) already owns the call: scratch type A, missing component, wrong polarity. Unknown means the part is not normal enough to pass and is not close enough to a labeled class to auto-disposition. Unknown always goes to human review. Do not auto-scrap unlabeled classes. A model that has never seen the defect cannot tell a harmless cosmetic from a reliability fail, and scrap automation on that signal will either burn yield or, worse, teach the line that the score is noise.
Typical triggers for standing this up: a new product or colorway with a thin labeled set, a supplier change, a tool or recipe change, seasonal lighting or fixture wear, or a run of customer escapes whose photos do not match any existing reject taxonomy. If your escape reviews keep ending in "we have never seen this," the labeled catalog is incomplete by construction.
Commercial vision and manufacturing-AI stacks that expose unsupervised or few-shot anomaly modes include Cognex, Instrumental, and Landing AI. Treat those as platforms that can host this pattern, not as a substitute for your disposition rules. The station logic (pass / known reject / unknown / hold) belongs to quality, not to the vendor default workflow.
How the model should be built and scored
Start from known-good, not from a mixed defect dump. Collect golden and production-good images (or traces) under the same optics, lighting, pose, and cycle time the live station will see. Include the normal variation you actually run: lot-to-lot texture, acceptable cosmetic bands, fixture play, and the lighting you get at shift change. If "good" in the training set is a lab coupon under perfect light, every real part will look anomalous.
Most practical systems score reconstruction error, embedding distance to a normal manifold, or a density estimate in feature space. You do not need to pick a paper architecture to run the line. You do need a score that is stable for the same part and sensitive to the failure modes you care about. Pin the camera, exposure, and preprocessing. If the score moves when a bulb ages, you are inspecting the illuminator.
Set two thresholds, not one. A lower bound defines "clearly normal." An upper bound defines "clearly not normal." The band between them is unknown or low-confidence, and that band is a review queue, not a maybe-pass. Calibrate those bounds on a holdout of known-good plus a small set of known defects and, if you have them, historical escape images. Optimize for missed unknowns, not for a pretty ROC on labeled classes you already detect.
Do not train the anomaly model on unlabeled defects and then treat the cluster as a scrap class. Clustering can help a reviewer name a new mode after the fact. It is not a license to auto-disposition. Until a human assigns a class, a control plan, and a scrap or rework rule, the part is on hold.
When a labeled detector already exists, run it first or in parallel and let it win on known classes. Anomaly scoring is the residual gate: "this is not in the catalog, and it is not normal." That residual is what Inspection Escape Root Cause Correlation later needs as a clean "unknown at inspect" flag, instead of a silent pass.
Station workflow: unknown means a person decides
Define the physical and MES path before you turn the model on. Unknown parts leave the pass stream. They go to a review station with the image, the score, the region of interest if the system produces one, and the current recipe and lot. The reviewer disposition is one of: pass with reason, known class (map into an existing reject code), new class (create a temporary code and escalate), or hold for MRB.
Review SLAs matter. If the unknown queue backs up into the palletizer, operators will start treating the gate as a nuisance and override it. Staff the queue for the first weeks after a changeover or supplier switch, when unknown rates jump. Log every override. An override without a photo and a reason is how you recreate the escape you were trying to stop.
Never wire the unlabeled score directly to a scrap diverter. Scrap and rework codes are process-control artifacts. They require a named failure mode, a sampling or 100% rule, and a path back into yield and cost. Auto-scrap on "anomaly" also poisons your data: you never learn whether the event was a true defect, a lighting glitch, or a new acceptable variant.
Feed confirmed new classes back with care. A handful of reviewed examples can seed a labeled detector or a dedicated check, which is the handoff to the inline vision playbook. Until that detector is validated, keep sending that pattern through review or a conservative known-reject rule you actually signed. Do not silently promote a cluster centroid into a scrap decision.
Operating the gate: data, change control, and metrics
Treat the normal model as a controlled artifact. Version the training set, preprocessing, and threshold pair. Re-qualify after optic or lighting changes, fixture redesign, material or color changes, and major recipe changes. A "soft" drift in score distribution is a process signal. Investigate it the way you would a shifting Cpk, not as a reason to nudge the threshold until the alarm stops.
Watch four rates, by recipe and lot: unknown rate, review agreement (reviewer confirms anomaly vs. calls it good), conversion of unknowns into new labeled classes, and escapes that had a low anomaly score. The last one is the miss that matters. If escapes pass with low scores, the normal envelope is too wide or the sensing is blind to that mode (wrong view, wrong spectrum, not in the image). If unknowns are almost all later passed by reviewers, the envelope is too tight or the station variation is not in the training set.
Tie this to yield only after disposition is clean. Anomaly holds will look like a first-pass yield hit until review closes. That is expected. Do not "fix" it by auto-passing the unknown band. For how inspection calls should inform yield models without hiding holds, see First-Pass Yield Prediction.
Keep a small, rotating escape and near-miss set in the evaluation pack. Retrain when reviewers keep naming the same new class, when unknown rate stays high after a known process change, or when score histograms for good parts have shifted. Retrain is not a weekly ritual. It is a response to evidence that the normal definition is stale.
Limits, false confidence, and what not to do
Anomaly detection is blind to defects that look like the variation you called good. If you trained on parts with a tolerated stain, a worse stain in the same region may not score. If the defect is on a face the camera never sees, the score is irrelevant. If cycle time forces a compressed JPEG and aggressive ROI crop, you may be scoring compression, not the part.
Adversarial cleanliness is a real factory issue: operators learn which wipe or orientation drops the score. Lock pose and cleaning SOPs. Sample passed parts, not only rejects. A gate that only ever reviews highs will never catch a collapsed threshold.
Is this worth automating for you?
Whether this pays back depends on how much time it takes your team today. Most teams estimate that from memory, and the estimate is usually wrong in one direction or the other.
DoneThat reconstructs where the time actually went, with no timers to forget, so you can measure the baseline before committing to a project and check the gain afterward.
Measure the baseline first