In the ideal world of computer vision research, training sets for anomaly detection are pristine—composed entirely of "normal" samples. In the real world, however, data is messy. Sensors malfunction, human annotators make mistakes, and legacy systems pass down mislabeled examples. When an anomaly detection model is trained on "contaminated" data (data containing hidden anomalies), it often learns to treat those anomalies as normal, leading to significant performance degradation.
A new framework presented at WACV 2024, "Adaptive Deviation Learning for Visual Anomaly Detection with Data Contamination," introduces a method designed to thrive in these imperfect conditions. The authors propose Adaptive Deviation Learning (ADL), a self-supervised framework that handles training data contamination by dynamically downweighting suspicious samples.
The Challenge of Contaminated Training Sets
Most Visual Anomaly Detection (VAD) models follow a "one-class" paradigm: they learn the distribution of normal data and flag anything that deviates from it. However, if the training set is contaminated with outliers, the model's "boundary" of normality expands to include them. Existing solutions often struggle with this; "blind" training ignores the noise, while iterative removal methods can be computationally expensive or discard useful data. The challenge is to create a model that can distinguish between a "true" normal sample and a "hidden" anomaly during training without explicit labels.
Methodology: The ADL Framework
The ADL framework uses a three-pronged strategy to combat contamination, as illustrated in the architecture below:
- Synthetic Anomaly Generation: To train the model to recognize what "bad" looks like, the authors generate pseudo-anomalies using Perlin noise and textures from external datasets (like the Describable Textures Dataset). This allows for self-supervised learning.
- Soft Deviation-Based Learning: Standard "Deviation Learning" uses hard labels (0 for normal, 1 for anomaly). ADL introduces a soft-deviation loss. It uses an auxiliary classification head to estimate the probability that a training sample is an anomaly. This probability acts as a "soft label," preventing the model from over-committing to the idea that every sample in the contaminated training set is perfectly normal.
- Adaptive Sample Importance Learning: This is the core "adaptive" component. The model treats the loss of each sample as a signal. Since noisy or mislabeled instances typically produce higher loss values, the framework uses a constrained optimization problem (employing KL or $\alpha$-divergence) to dynamically assign lower weights to high-loss samples during each mini-batch.
The architecture uses a pre-trained ResNet-18 backbone to extract multi-scale features, which are then fed into scoring, classification, and segmentation networks.
Experimental Results
The authors evaluated their method on two primary industry-standard benchmarks: MVTec AD (15 categories of industrial objects) and VisA (12 categories including complex structures like PCBs). To simulate real-world conditions, they artificially contaminated these datasets by injecting anomalies from the test sets into the training sets at ratios of 5%, 10%, 15%, and 20%.
As shown in the results, the ADL framework consistently outperformed state-of-the-art baselines like PatchCore, DestSeg, and DRÆM, particularly as the contamination level increased. While methods like PatchCore saw sharp performance cliffs as noise increased, ADL’s performance degraded much more gracefully. At 20% contamination on MVTec AD, ADL achieved an average AUC-ROC of 0.873, significantly higher than PatchCore (0.690) and DRÆM (0.790).
Key Insights and Limitations
The most powerful idea in ADL is using the training loss itself as a filter. By reweighting samples based on their loss relative to a reference distribution, the model effectively "ignores" the samples it finds most confusing—which are likely the hidden anomalies. Additionally, integrating a segmentation loss was found to significantly improve the overall stability and average performance of image-level detection.
Despite its strengths, the paper notes some failure cases in complex classes like cables, transistors, and screws, where performance dropped by 9-13% under high contamination. These objects often have intricate structures where a "hidden" anomaly might look very similar to a legitimate "normal" variation, making it harder for the reweighting mechanism to distinguish noise from variance. Future work is expected to focus on improving anomaly localization and enhancing model explainability.
Summary updated