MVTec AD

Also known as: MVTec Anomaly Detection dataset

On this page 7

MVTec AD, the MVTec Anomaly Detection dataset, is a public benchmark of high-resolution industrial images designed to evaluate unsupervised visual anomaly detection and pixel-level defect localization. In anomaly detection research, it became the reference dataset for industrial inspection after its release in 2019, because it pairs defect-free training images with test images that contain real manufacturing defects and precise ground-truth masks.

The dataset reflects a realistic constraint of factory inspection: defects are rare and varied, so models must learn what normal looks like and flag anything that deviates. Methods are trained only on good samples and judged on how well they detect and localize unseen defects.

Structure and contents of MVTec AD

MVTec AD contains 5,354 color and grayscale images across 15 categories, split into 3,629 defect-free training images and 1,725 test images. Five categories are textures with repetitive surface patterns, and ten are objects with a defined shape and position. Image resolutions range from about 700 by 700 to 1024 by 1024 pixels.

GroupCategoriesTypical defects
TexturesCarpet, grid, leather, tile, woodCuts, holes, stains, color changes
Rigid objectsBottle, metal nut, screw, transistorScratches, bent parts, missing parts
Deformable or variable objectsCable, toothbrush, zipper, hazelnutCut wires, broken teeth, cracks
Pharmaceutical itemsCapsule, pillFaulty imprint, contamination, cracks
Category groups in MVTec AD

The test set covers 73 distinct defect types and also contains defect-free images, so a method must separate good from bad parts rather than only find defects. Every defective test image comes with a pixel-accurate segmentation mask, which enables localization metrics as well as image-level classification.

How MVTec AD is used for evaluation

Evaluation on MVTec AD follows a one-class protocol: a separate model, or a separate memory bank, is fitted for each category using only its normal training images. At test time the model outputs an image-level anomaly score and an anomaly map with a score for every pixel, and both are compared with the ground truth.

MetricWhat it measuresLevel
Image AUROCSeparation of good and defective imagesImage
Pixel AUROCSeparation of normal and anomalous pixelsPixel
PRO scoreAverage overlap per connected defect regionRegion
Pixel AUPRPrecision and recall on rare anomalous pixelsPixel
Standard evaluation metrics on MVTec AD

The per-region overlap (PRO) metric was introduced because pixel AUROC favors large defects: a method can score well by detecting big defects while missing small ones. PRO weights each defect region equally and is usually computed up to a false positive rate of 30 percent. Results are reported per category and as a mean across all 15.

Methods developed on MVTec AD

MVTec AD drove a shift from reconstruction-based detection toward feature-embedding methods that reuse networks pretrained on large natural image datasets. Early autoencoders and GAN-based detectors struggled because they reconstructed defects too well, while embedding methods compare local features of test patches with a model of normal features.

FamilyRepresentative methodsStrengthWeakness
ReconstructionAutoencoders, GAN-based modelsSimple, no pretrained backboneWeak on subtle defects
Feature embeddingPaDiM, PatchCoreVery high image AUROCLarge memory banks
Knowledge distillationStudent-teacher networksFast inferenceSensitive to backbone choice
Normalizing flowsFlow-based density modelsCalibrated likelihood scoresHeavier training
Synthetic anomaliesPasted or generated defectsStrong localizationBias toward simulated defects
Method families and their behavior on MVTec AD

Leading methods now reach image AUROC above 99 percent on average, and several categories are effectively solved. PatchCore, which stores a coreset of pretrained patch features and scores test patches by nearest-neighbor distance, is a common baseline for this reason.

Localization remains harder than detection. Pixel AUROC values near 98 percent can coexist with noticeably lower PRO scores, because thin scratches and small contaminations cover few pixels and are easily blurred by the coarse resolution of pretrained feature maps. Texture categories are generally easier than object categories such as screw, capsule and transistor, where position, orientation and missing parts matter. Inference speed and memory use also vary widely between methods, so published accuracy alone is a poor guide for selecting a production system.

Limitations of the benchmark

The most serious limitation of MVTec AD is benchmark saturation: when top methods differ by fractions of a percentage point, the dataset no longer separates them reliably. Small test sets per category mean that a handful of images can change the ranking, so reported differences are often within noise.

  • Controlled imaging conditions, with fixed lighting and centered objects, make the task easier than many production lines.
  • Structural defects dominate, so the dataset barely tests logical anomalies such as a missing or misplaced component.
  • Some masks and labels are ambiguous, especially for subtle texture defects, which caps achievable pixel scores.
  • Hyperparameter tuning on the test set is a common methodological flaw because no separate validation split exists.
  • The non-commercial license limits direct use of the images in commercial products.

Several datasets extend MVTec AD to cover its gaps, and serious evaluations now report results on more than one benchmark. The same group released MVTec LOCO AD for logical constraints and MVTec 3D-AD for depth data, while VisA added more complex multi-instance scenes.

DatasetMain additionUse
MVTec LOCO ADLogical and structural anomaliesTests global reasoning
MVTec 3D-ADPoint clouds with RGB imagesGeometric defect detection
VisAMultiple and misaligned objectsHarder object-level inspection
Real-IAD and similarLarger multi-view industrial setsScalability and realism
Benchmarks commonly reported alongside MVTec AD

Stripped to the essentials

MVTec AD is a shared test collection of product photos. It shows things like screws, pills, cables and pieces of carpet. Most photos show perfect items. Some show items with scratches, cracks or stains.

Researchers teach a program using only the perfect photos. Then they check whether it can spot the faulty items and point to the flaw. Because everyone uses the same photos, results are easy to compare. Today the best programs do so well that the test has become too easy, so newer collections are used as well.

Where it is applied

A machine-vision team at a mid-sized electronics supplier wants to inspect connectors for bent pins and surface damage. Real defect images are scarce, so the team first compares three unsupervised methods on MVTec AD, focusing on the transistor, metal nut and screw categories, which resemble their parts.

A PatchCore-style model gives the best balance of accuracy and speed there, so the team trains it on about 300 good connector images from its own line. On a held-out set of 120 real defects, the model detects 112, and the anomaly maps let operators confirm each rejection within seconds. The benchmark result guided the choice, but acceptance was based on the team’s own production data, since MVTec AD conditions differ from the factory.