Unsupervised Anomaly Detection vs Supervised Defect Detection

The question deserves asking directly, including by those whose business is annotation: is annotation always necessary? One family of methods learns only on conforming parts and flags any deviation, without a single defect ever being labelled. On a running line, assembling a set of conforming parts is trivial. Annotation would then be an avoidable cost.

The honest answer is that it sometimes is, and a provider who does not say so is doing a disservice. It is not always, and the cases where it is not can be characterised precisely. This article establishes that boundary: what each approach can do, what it cannot, and how to choose. It closes the complete guide to defect detection, to which it refers for cross-cutting concepts.

Two opposite starting assumptions in defect detection

The difference between the two approaches is epistemological rather than technical: they do not presuppose the same prior knowledge of the problem.

The supervised approach

It presupposes that the list of defects is known, that examples of each exist in sufficient number, and that a quality standard allows them to be named. The model learns to recognise what it was shown, and it is explicitly optimised for that list.

The unsupervised approach

It presupposes only that normality is representable. The logic is described in the field’s literature as follows: the approach follows the setting of training with normal samples only and detecting or localising anomalies at test time, which addresses practical challenges in real production lines where anomalous samples are scarce and their appearances are hard to anticipate.

That formulation contains the essence of the case for unsupervised methods: defect scarcity and the impossibility of anticipating their appearance are structural properties of industrial inspection, not project accidents.

What each approach can do

The comparison between the two defect detection approaches is better made capability by capability than on overall performance, since they do not answer the same question.

Detecting an unknown defect

This is the decisive advantage of unsupervised methods. A supervised model will never flag a failure mode absent from its training, and that silence is more dangerous than a false alarm. An anomaly detector flags any deviation, including ones nobody anticipated, which matches the need exactly when a change of material or tooling produces a new defect.

Naming and grading

This is the symmetric advantage of supervised methods. An anomaly detector produces a deviation score, not a category or a severity. Yet quality decisions almost always rest on those two: a three-millimetre scratch in a cosmetic zone does not call for the same outcome as a pore with the same anomaly score. Without a name or a grade, the system output is not actionable as it stands.

Reaching precision

On defects for which examples exist, supervised methods win, and the gap is not marginal. One source in the field puts it plainly: if you do have labelled defect data, a supervised defect detection model will typically outperform an unsupervised anomaly detector, with the one-class approach strongest when defect labels are scarce or when unknown defect types must be caught.

That sentence summarises the boundary better than a long argument. Unsupervised methods are not a budget version of supervised ones, they are an answer to a different situation.

The limits of unsupervised methods

Three documented limits explain why annotation does not disappear from defect detection projects, and they are worth knowing before founding a project on this approach.

Delineating the defect

One analysis of the field notes that since unsupervised methods do not incorporate anomalous features during training, accurately detecting defect areas in anomaly instances remains challenging.

In other words, these methods locate the anomaly approximately but delineate it poorly. On a task where the decision rule concerns a dimension, crack length, affected area, that imprecision is disqualifying. It is the limit most frequently encountered in practice.

Contextual defects

A second limit concerns deviations that do not translate into a marked local departure. One publication notes that an approach based on memorising normal patterns effectively captures structural anomalies but is less suitable for detecting context-dependent defects, where minor variations in appearance do not necessarily correspond to a clear deviation from normal patterns.

That category covers a substantial share of real industrial needs: a component present but wrongly oriented, a correct colour in the wrong place, a conforming part in a non-conforming assembly.

Logical anomalies

This third limit is structuring enough to have prompted a dedicated dataset. Its authors distinguish the two natures explicitly: structural anomalies appear as scratches, dents or contaminations in the manufactured products, while logical anomalies violate underlying constraints, for example a permissible object present in an invalid location or a required object not being present at all.

An anomaly detector based on local appearance does not see a missing part, since every visible area is individually normal. That observation points towards different approaches, and it explains why this defect type remains an active research subject.

What unsupervised methods still require

A frequent confusion deserves clearing up: without defect labels does not mean without work on the data.

A clean corpus of normality

The method learns what it is shown as normal. If the training corpus contains unnoticed defective parts, the model learns those defects are normal and will stop flagging them. Assembling a set of conforming parts therefore requires verification, meaning human examination, even if it produces no detailed annotation.

This point is routinely underestimated. On a line with a low scrap rate, a random draw statistically contains a few defective parts, and their presence silently degrades the model.

Coverage of normal variability

The corpus must cover the full extent of what is normal: references, batches, shades, lighting conditions, times of day. Partial coverage produces a system that flags ordinary variation, which is the principal failure mode of this approach in production.

An annotated evaluation corpus

This is the decisive point and the least often stated. Measuring an anomaly detector’s performance requires knowing which parts of the test set are defective and where. That ground truth is built by annotation, exactly as for a supervised approach.

The field’s reference datasets reflect this: all training and validation images represent anomaly-free instances, whereas test sets include both pristine and anomalous samples, with pixel-precise binary masks as ground truth.

In other words, even the emblematic unsupervised dataset contains an annotated part, and that part is indispensable. The unsupervised approach sharply reduces annotation volume; it does not remove it.

The threshold, a question common to both

One difficulty specific to unsupervised methods deserves flagging: the anomaly score has no interpretable scale.

A supervised model produces a probability of belonging to a named class, whose threshold is set according to error costs. An anomaly detector produces a deviation measure whose absolute value means nothing: it depends on the model, the product category and the training distribution.

The threshold must therefore be calibrated empirically on a sample whose status is known, which again returns to a need for annotation. And that calibration must be redone at every change of reference or conditions, where a supervised model retains the semantics of its classes.

Hybrid approaches in defect detection

Mature industrial practice does not choose, it combines, and that combination is now recommended in the literature.

A recent comparison work sets out the principle: faced with the persistent failure of bounding-box detection on periodic texture defects, the authors propose a hybrid detection-anomaly architecture where a supervised detector handles structural, localised defects constituting the majority of classes, while anomaly scoring handles periodic texture defects, with an expected benefit of near-complete class coverage for modest additional compute.

That architecture is the soundest answer to the dilemma. Supervised methods bring precision, naming and grading on known defects, which represent most of the volume. Unsupervised methods bring the safety net on new failure modes, which represent most of the risk.

Implementing it requires a two-level annotation strategy: a finely annotated corpus on the frequent classes, and a verified corpus of conforming parts for the unsupervised branch. That is not more expensive than a supervised approach alone, since the second part requires no detailed annotation.

Comparative cost of the two approaches

The economic comparison between the two defect detection approaches is more nuanced than the shorthand “unsupervised avoids annotation” suggests.

On the data line, the gap is real but partial. A supervised approach requires a corpus annotated per class, with delineation and grading, plus an evaluation corpus. An unsupervised approach requires a verified corpus of conforming parts, markedly cheaper per unit, plus the same annotated evaluation corpus. The saving therefore applies to training, not to evaluation.

On the operations line, the gap frequently reverses. A poorly calibrated anomaly detector generates a volume of flags to verify, and that manual verification load is recurrent where the annotation cost was one-off. Over several years, an imprecise system can cost more than an annotated corpus.

On the maintenance line, the gap also favours supervised methods on stable production, since a model that names its classes can be diagnosed and corrected, whereas an anomaly detector whose flag rate drifts requires recalibration whose cause is harder to establish.

Choosing an approach: a decision grid

Five questions are enough to orient the choice of a defect detection approach, and they belong at scoping.

Is the defect list known and stable? If so, supervised is feasible; if new modes appear regularly, an unsupervised component is necessary.

Do examples exist in number? On new or very well controlled production, they may be missing for months, which makes supervised impractical in the short term.

Does the decision rest on a measurement? If the quality rule mentions a dimension, the imprecise delineation of unsupervised methods disqualifies the approach on its own.

Is the defect structural or logical? A missing component, an inversion, an incorrect order escape methods based on local appearance.

Is normality stable? On a highly variable product or a line with frequent setting changes, the corpus of conforming parts becomes hard to assemble and the false alarm rate high.

When unsupervised methods are the right choice

Four situations clearly tip the balance, and naming them is more honest than leaving them unsaid.

Starting up new production, where no defect history exists and waiting would mean losing months. Small series, where annotation cost does not amortise over volume, a situation covered in the article on costing. Very well controlled production, where the defect rate is so low that gathering examples would take years. And contexts where the main stake is detecting the unexpected rather than classifying the known, notably in safety.

In those four cases, recommending a supervised approach would mean selling annotation work that is not justified. A provider able to say so gains credibility worth more than the lost engagement.

When annotation remains unavoidable

Symmetrically, five situations make annotation necessary in defect detection, and no unsupervised method covers them.

Where the quality decision rests on a dimensional measurement, precise delineation is required. Where it rests on a category, the defect name is required. Where a normative standard imposes a grade, the scale must be learned. Where regulatory traceability requires documenting what the system detects, an interpretable output is required. And in every case, evaluation requires an annotated test corpus, without which no performance is demonstrable.

That last point is the most general and the most often neglected. Whatever the approach, the evaluation corpus is annotated. That is why annotation disappears from no serious project, even where it disappears from training.

A progressive trajectory rather than a fixed choice

Presenting the decision as a definitive choice is a simplification that does projects a disservice. In practice, a trajectory works better than an initial arbitration.

The natural starting point is unsupervised, precisely because it does not demand what is not yet available. It produces an operational system quickly, it covers unforeseen defects from day one, and above all it generates something valuable: the cases it flags constitute a corpus of real defects, selected by the system itself.

That corpus, once verified and annotated, feeds a supervised branch on the classes that have become frequent. The system therefore evolves from general detection towards precise classification, at the pace of what production reveals, without any mass annotation campaign having been necessary at the outset.

That trajectory has a useful scoping implication for a defect detection project: it turns annotation from a blocking upfront investment into a progressive effort justified by observed data. It is often the framing that unblocks a client hesitant to commit to a corpus whose composition they do not yet know.

What model evolution changes

The boundary described here moves with the state of the art, and saying so beats freezing a snapshot.

Recent general-purpose models reduce the example requirement for supervised methods, shifting the boundary in their favour on tasks where it was impassable. Few-shot approaches allow a detector to be adapted from a handful of cases. Conversely, unsupervised methods are improving on localisation and beginning to address logical anomalies.

Two observations remain stable nonetheless. A model cannot name a category nobody has defined for it, and that definition is a human act nothing automates. And performance is demonstrated only against a reference, which stays annotated. Neither point depends on the state of the art; both follow from the nature of the problem.

What this means for an annotation provider

An article questioning the necessity of annotation in defect detection must conclude on what that implies for those who practise it, or it looks self-serving.

The consequence is a shift, not a disappearance. Training annotation volume shrinks on part of the projects, and that share will grow as unsupervised methods improve. Three needs strengthen in return.

Building rigorous evaluation corpora becomes more critical, since it underpins performance demonstration whatever the approach, and it demands more care than a training corpus. Verifying corpora of conforming parts, a less visible but indispensable task for unsupervised methods, constitutes a new need. And progressive annotation of cases flagged by a system in operation becomes a continuous flow rather than a single campaign.

That shift is favourable to whoever sees it. It replaces a one-off volume with a durable engagement, and it values method over raw capacity. A provider selling annotated images by volume is subject to this evolution; a provider selling a corpus construction and validation arrangement finds firmer ground in it.

How to run the defect detection comparison honestly

Choosing between the two defect detection approaches is often settled by preference rather than by evidence, and the evidence is cheaper to gather than the argument is to have.

The workable method is a short parallel evaluation on the same data. An unsupervised model is trained on conforming parts alone, a supervised model on a small annotated subset, and both are evaluated on the same held-out set with the same metrics. Two or three weeks are usually enough, and the result is specific to the material, the acquisition setup and the defect population rather than to the literature.

Three outcomes recur. The unsupervised model performs adequately and the supervised advantage does not justify the annotation cost, which settles the question. The supervised model performs markedly better on the classes that matter commercially, which justifies the investment with evidence rather than assertion. Or both underperform, which almost always indicates an acquisition problem rather than a method problem, and redirects the effort where it belongs.

That last outcome is the most valuable and the least expected. A comparison run early frequently reveals that the binding constraint is optical rather than algorithmic, saving a project from spending its budget on the wrong problem.

The most common mistakes

These failures recur often enough across projects that naming them is usually enough to avoid them.

  • Choosing unsupervised methods to avoid annotation, then discovering evaluation requires it.
  • Assembling a corpus of conforming parts without verification, including unnoticed defects.
  • Partially covering normal variability and producing an unmanageable alert rate.
  • Expecting an anomaly score to supply a category or a severity.
  • Using unsupervised methods on a task whose decision rule rests on a measurement.
  • Hoping to detect a logical anomaly with a method based on local appearance.
  • Not recalibrating the threshold at every change of reference or conditions.
  • Opposing the two approaches instead of combining them in a hybrid architecture.
  • Choosing an approach before formulating the quality decision rule.

Explaining the choice internally

One consequence of the unsupervised defect detection route is worth anticipating because it surfaces after deployment rather than during selection: a system that flags without naming is harder for an organisation to work with.

A supervised system tells an operator that a part shows a specific, named defect, which connects directly to the quality standard and to a known corrective action. An unsupervised system says the part is unusual, which is true and much less actionable. Operators asked to act on that distinction without further information tend either to over-reject out of caution or to disregard the flag entirely.

Two arrangements mitigate this without abandoning the approach. Presenting the anomaly map alongside the flag, so the operator sees where the system is looking and can judge for themselves, converts an opaque verdict into a usable hint. And progressively labelling the recurring anomaly types as they are encountered, which is a small annotation effort applied where it produces the most value, gradually restores the naming the organisation needs. That second route is in practice how many deployments evolve, which is another reason to treat the two approaches as a sequence rather than a fork.

What to take away

Unsupervised methods are not a budget alternative to supervised ones, they answer a different question. They excel where the defect is unpredictable and examples are missing; they fail where the decision requires naming, grading or measuring. Those two domains overlap little, which is why mature practice combines them.

Three decisions structure an informed choice. Start from the quality decision rule rather than from data availability, since a rule based on a measurement immediately disqualifies an approximate approach. Provide for an annotated evaluation corpus whatever the approach, since no performance is demonstrable otherwise. And treat the hybrid architecture as the default case rather than a refinement, with supervised methods covering the volume and unsupervised methods covering the risk.

For approaches, ontology and annotation tasks, the complete guide to defect detection sets the general frame. For concrete integration in a production environment, where the choice of approach meets throughput and lighting constraints, the article on automated quality control on a production line covers deployment conditions.

To explore delivery arrangements, supported formats and applicable control mechanisms, see our dedicated page on annotation for industry. And if you are weighing the two approaches for an inspection project, let us discuss your case: scoping is often quicker than expected.

Tags

Découvrez nos articles