Skip to content

Anomaly Detection vs Supervised Defect Classification: Different Data

By Noah Loul · Reviewed by Noah Loul · Updated

  1. 01Your data spec
  2. 02Matched to businesses
  3. 03Rights and samples reviewed
  4. 04Licensed delivery
How it works with SourceX: Your data spec → Matched to businesses → Rights and samples reviewed → Licensed delivery.Illustrative

Short answer

Anomaly detection learns what normal looks like from defect-free images and flags deviations, so it needs plentiful, consistent normal samples and a small labeled test set. Supervised defect classification needs examples of each defect class with labels, which are scarce for rare defects. The two approaches call for different purchases, labels, and evaluation sets, and many programs combine them.

The buyer's problem

An inspection model has to be trained on something. Quality systems hold large numbers of images of acceptable parts and very few images of each failure mode. A data lead specifying a purchase has to decide whether to ask for mostly normal images, mostly defect images, or both, and what labeling the budget must cover.

Choosing the wrong framing wastes the purchase. A pile of unlabeled normal images cannot teach a classifier what a crack looks like, and a small set of labeled cracks cannot define normal variation on a production line.

Two approaches, two data shapes

PatchCore is a cold-start method that fits a memory bank of patch features from nominal, defect-free images only, and reports image-level AUROC up to 99.6% on MVTec AD (Roth et al., 2021). That is a result on one research benchmark; it says what the method can do when the normal data is clean and the test defects resemble those in the benchmark, not what it will do on your line.

The benchmark's structure is the useful model for buyers. MVTec AD contains 5,354 images across 15 categories, with a training set of defect-free images only, a test set containing defects, and pixel-precise ground truth for the anomalies (Bergmann et al., 2021). Normal data trains; labeled defects are used to measure.

Supervised approaches flip this. A segmentation-based network for surface defects, evaluated on electrical commutators, is trained with pixel-level defect annotation and was designed to learn from few defective samples (Tabernik et al., 2019). It needs labeled defect examples, but not a large count.

DimensionAnomaly detectionSupervised defect classification
Training imagesNormal, defect-freeNormal and defective, labeled
Labels for trainingNone or image-level "normal"Class, location or mask per defect
Labels for evaluationDefect masks or flags on test setHeld-out labeled defects
Handles unseen defect typesOften flags them as anomaliesOnly classes seen in training
OutputAnomaly score, heat mapDefect class, severity, location
Main data riskHidden defects or drift in the "normal" setToo few examples per class; label inconsistency
Typical purchaseMany reference images, fixed conditionsCurated defect images with an agreed taxonomy

Where the boundary blurs

Real-IAD, a multi-view industrial dataset with 150K high-resolution images of 30 objects, proposes a fully unsupervised setting in which the training data may contain defective images (Wang et al., 2024). That matters commercially: production archives are rarely clean. If normal images may include unflagged defects, the buyer should know the estimated contamination rate and how it was checked.

Hybrid designs are common. A team might use an anomaly model for screening and a supervised classifier to name the defect once found, or fine-tune an anomaly model with a few labeled defects. The data requirement is then the union, with a shared evaluation set.

Decision criteria

  • Choose anomaly-first when defects are rare or varied, new failure modes appear often, and normal parts are plentiful and consistently imaged.
  • Choose supervised-first when the defect classes are known and stable, disposition depends on defect type, and there are enough labeled examples per class or ways to obtain them. See rare defects and class imbalance.
  • Choose both when you need screening plus classification, or want a supervised model to refine the anomaly model's false alarms.
  • Neither suffices when the task requires handling the part to expose the defect; see active inspection by humanoids.

What this means for what you buy

For anomaly detection, specify the normal set tightly: one part type per set, fixed imaging conditions, a stated process for excluding defective parts, and enough variation in lighting, fixture position and lot to represent real normal. Golden samples and reference images covers the reference side.

For supervised classification, specify the taxonomy before collection, since labels cannot be reconstructed later. Mask-level annotation is covered in pixel-level defect segmentation, and the broader sourcing picture is in defect image datasets.

For both, specify the evaluation set separately. It should include defects the training data did not contain, and be held out by line, lot or time, as described in defect detection evaluation sets.

Illustrative requirement block

# Illustrative only - synthetic values
inspection_target: part_family_A (single SKU)
approach: anomaly_detection_with_supervised_refinement
normal_set:
  source: in-line camera, station_03
  exclusion_rule: parts passing final QC only
  contamination_check: 200-image manual audit by two inspectors
  variation: 3 lots, 2 shifts, 2 fixture positions
defect_set:
  taxonomy: supplied (12 classes)
  labels: class + bounding box; masks for 3 priority classes
  min_examples_per_class: buyer-defined, stated per class
eval_set:
  holdout: separate lot and date range
  includes_unseen_defect_types: yes
imaging: resolution, lens, lighting recorded per image
rights: training and evaluation; no redistribution

The numbers in a real requirement depend on the architecture, defect sizes and tolerance for false alarms. Do not copy figures from published benchmarks as targets.

Limits of both approaches

Neither approach decides whether a flagged item is acceptable. That depends on acceptance criteria, often written in standards and customer specifications; see acceptance standards as label definitions. Both are sensitive to domain shift when cameras, lighting or products change; see domain shift across lines. Public datasets have license limits: MVTec AD, for instance, carries a non-commercial share-alike license, which matters before you train a commercial model on it.

Questions to ask suppliers

  1. Are the "normal" images verified defect-free, and how?
  2. How many parts, lots, shifts and fixtures do the normal images cover?
  3. What defect classes exist, how many examples of each, and who labeled them?
  4. Are labels image-level, boxes or masks, and how were disagreements resolved?
  5. Were defective parts physically retained so images can be re-taken?
  6. Are camera, lens, lighting and exposure recorded per image?
  7. Can the supplier provide a held-out set from a different lot or line?
  8. Do images show customer parts, branding or process details that restrict licensing?

Discuss your requirements

If you can state the part, defect classes and imaging conditions, describe your inspection data requirement to SourceX. SourceX investigates whether US businesses hold suitable images, checks the data and the supplier's licensing permissions, and follows up about potential sources; a request does not guarantee a match. Start from the humanoid training data guide or the inspection and defect data hub, or see the catalog entries for images and inspection photos and manufacturing quality records.

Explore sourcing and licensing options with SourceX

Sources

Frequently asked questions

How do anomaly detection and supervised defect classification differ in data needs?

Anomaly detection learns what normal looks like from defect-free images and needs plentiful, consistent normal samples and a small labeled test set. Supervised classification needs labeled examples of each defect class, which are scarce for rare defects.

Why does the normal image set for anomaly detection need a contamination check?

Production archives are rarely clean, and some normal-looking images may contain unflagged defects. The buyer should know the estimated contamination rate and how it was checked, for example by a manual audit of the normal set by two inspectors.

When should a buyer choose anomaly-first rather than supervised-first inspection data?

Anomaly-first suits defects that are rare or varied, where new failure modes appear often and normal parts are plentiful and consistently imaged. Supervised-first suits known, stable defect classes whose disposition depends on defect type, with enough labeled examples per class.

Describe the data your robots need

Describe the tasks, modalities and permitted uses you need. SourceX reviews the requirement and follows up about potential sources; a request does not guarantee a match.

Discuss your humanoid training-data requirements with SourceX
See if you qualify