Source-linked AI summary
DSR -- A dual subspace re-projection network for surface anomaly detection
Vitjan Zavrtanik, Matej Kristan, Danijel Skočaj
TL;DR
Surface anomaly detection often relies on auxiliary datasets to synthesize anomalies, but realistic synthesis is difficult for near-in-distribution defects. DSR uses dual decoders and a quantized feature space to generate controlled feature-level anomalies without visual-property assumptions. On KSDD2 and MVTec, it achieves state-of-the-art results, including 10% AP and 35% AP improvements on KSDD2 tasks.
Problem
Auxiliary-dataset anomaly synthesis is difficult to make realistic for near-in-distribution anomalies, limiting discriminative unsupervised surface anomaly detection.
Method
DSR uses dual reconstruction branches with a discretized latent representation to generate synthetic anomalies directly in feature space.
Results
DSR achieves state-of-the-art results on KSDD2 and MVTec, outperforming other unsupervised methods on KSDD2 by 10% AP in anomaly detection and 35% AP in anomaly localization.
Takeaways & Limitations
Feature-space anomaly generation produces near-in-distribution synthetic anomalies without assumptions about anomaly appearance or image-level heuristics.
Takeaways & Limitations
The anomaly-generation sampling method significantly affects final detection results, and more complex feature sampling may improve performance.
Abstract
from arXiv · showhide
The state-of-the-art in discriminative unsupervised surface anomaly detection relies on external datasets for synthesizing anomaly-augmented training images. Such approaches are prone to failure on near-in-distribution anomalies since these are difficult to be synthesized realistically due to their similarity to anomaly-free regions. We propose an architecture based on quantized feature space representation with dual decoders, DSR, that avoids the image-level anomaly synthesis requirement. Without making any assumptions about the visual properties of anomalies, DSR generates the anomalies at the feature level by sampling the learned quantized feature space, which allows a controlled generation of near-in-distribution anomalies. DSR achieves state-of-the-art results on the KSDD2 and MVTec anomaly detection datasets. The experiments on the challenging real-world KSDD2 dataset show that DSR significantly outperforms other unsupervised surface anomaly detection methods, improving the previous top-performing methods by 10% AP in anomaly detection and 35% AP in anomaly localization.
1 Introduction
Surface anomaly detection must learn from abundant anomaly-free images because production defects are rare, small, and sometimes visually close to normal appearance. DSR addresses limitations of image-level anomaly synthesis with dual reconstruction branches and discretized latent representations.
- Surface anomaly detection localizes image regions that deviate from normal object appearance in industrial inspection.
- Anomaly-free images are commonly used because production-line anomalies are rare, making supervised training datasets infeasible to acquire.
- L2- and SSIM-based reconstruction methods detect anomalies poorly when their appearance differs only slightly from normal regions.
- Image-level discriminative methods require annotated anomalies and auxiliary datasets, yet their performance degrades on near-in-distribution anomalies because realistic simulation is difficult.
- DSR combines dual image-reconstruction branches with discretized latent representations and generates anomalies in latent space rather than relying on auxiliary anomaly datasets.
- DSR substantially outperforms state-of-the-art methods on near-in-distribution anomalies in KSDD2 and achieves state-of-the-art performance on MVTec.
2 Related Work
Related work includes reconstruction-based methods that infer anomalies from reconstruction failures and discriminative methods trained with synthetic anomalies. These approaches differ in whether they use reconstructed images or features and whether they require simulated anomaly examples.
- Reconstruction-based methods train encoder-decoder networks on anomaly-free images and detect regions that reconstruction fails to reproduce.
- Feature-reconstruction approaches use pretrained-network features, concatenated feature maps, or auto-encoders to model normal representations.
- Discriminative methods train anomaly detectors with synthetically generated anomalies, sometimes using reconstruction networks to reduce overfitting to synthetic appearance.
3 DSR
DSR projects images into a two-level quantized latent space and uses dual decoders specialized for general and object-specific appearance. It generates training anomalies by sampling nearby codebook features, then compares decoder reconstructions to localize anomalies.
- Dual decoders: The general appearance decoder reconstructs arbitrary natural images, while the object-specific decoder reconstructs only normal local appearances of the selected object.The object-specific pathway restricts allowed spatial quantized-feature configurations to those agreeing with observed normal appearances.
- Quantized latent space encoder: DSR projects each input image into low- and high-resolution quantized feature maps using codebooks Klo and Khi.The maps are respectively 8× and 4× smaller than the original image.
- Upsampling module: The feature-resolution mask is concatenated with the input image and passed through an upsampling module to produce the final full-resolution mask.The mask is first bilinearly upsampled before concatenation.
- Feature-space anomaly generation: DSR generates near-in-distribution training anomalies by replacing anomaly-mask-selected quantized features with uniformly sampled nearby codebook vectors.Sampling avoids both trivial out-of-distribution changes and vectors so similar to normal features that they produce false positives.
- Training procedure: The DSR training procedure first learns the quantized encoder, codebook, and general decoder on ImageNet before fixing them for subsequent training.Later training optimizes the object-specific decoder and anomaly detection model using anomaly masks, feature distances, and reconstruction distances.
4 Experiments
Experiments on KSDD2 and MVTec show that DSR performs strongly on challenging near-in-distribution anomalies, including under unsupervised and supervised settings. Ablations further indicate that feature-based anomaly generation, informed codebook sampling, combined reconstruction losses, and upsampling contribute to performance.
- KSDD2: KSDD2 contains real production-line anomalies that often closely resemble normal appearances, providing a challenging test of anomaly detection.The unsupervised training split uses only anomaly-free images, while APdet and APloc measure image-level detection and pixel-level localization.
- KSDD2: 7.9 p.p. higher image-level AP than the previous best method was achieved by unsupervised DSR on KSDD2.DSR also reports higher anomaly-detection and localization AP than MAD, PaDim, and DRAEM, with successful qualitative localization despite heterogeneous normal appearance.
- KSDD2 supervised extension: 13.9 p.p. higher APdet than the weakly supervised method was achieved by completely unsupervised DSR on KSDD2.With segmented anomalous training images, performance improves further; DSR achieves the highest APloc across the reported training settings.
- MVTec: 98.2% mean AUROC and 70.2% localization AP were achieved by DSR on MVTec, exceeding recent state-of-the-art approaches.DSR exceeds DRAEM by 0.2 percentage points in mean AUROC and performs strongly on classes with more prevalent near-distribution anomalies.
- Ablation study: Feature-based anomaly generation outperforms image-based anomaly generation on MVTec for both anomaly localization and detection.The comparison uses DSRimg for training with image-based anomalies from out-of-distribution datasets.
- Ablation study: Uniform codebook sampling causes a significant performance drop, while combined image and feature reconstruction losses improve robustness and localization.Removing upsampling reduces localization performance but leaves image-level detection unchanged because that score uses the lower-resolution anomaly map.
5 Conclusion
DSR combines dual reconstruction branches with discretized latent representations to generate controlled feature-space anomalies without image-level heuristics. It achieves strong benchmark performance, including real-time operation, while anomaly-generation sampling remains an open improvement area.
- 5 Conclusion: DSR uses dual image reconstruction branches with a discretized latent representation for surface anomaly detection.The representation supports feature-space anomaly generation rather than image-level synthesis.
- 5 Conclusion: Controlled feature-space sampling generates near-in-distribution synthetic anomalies without assumptions about anomaly appearance or image-level heuristics.These synthetic anomalies support detection when anomaly appearance is close to normal appearance.
- 5 Conclusion: 10% AP in anomaly detection and 35% AP in anomaly localization: DSR outperforms other unsupervised methods on the challenging KSDD2 dataset.DSR also achieves state-of-the-art results on MVTec and improves related supervised methods when few annotated examples are available.
- 5 Conclusion: Anomaly-generation sampling significantly affects final detection results, leaving more complex feature sampling as future research.The ablation study suggests that improving the feature sampling method may further improve performance.
- 5 Conclusion: 58 FPS makes DSR suitable for real-world industrial applications with real-time requirements.The paper also reports performance across several tasks and use of anomalous training samples available in practical scenarios.