A Comprehensive Augmentation Framework for Anomaly Detection

Jiang Lin, Yaping Yan

Abstract: Data augmentation methods are commonly integrated into the training of anomaly detection models. Previous approaches have primarily focused on replicating real-world anomalies or enhancing diversity, without considering that the standard of anomaly varies across different classes, potentially leading to a biased training distribution. This paper analyzes crucial traits of simulated anomalies that contribute to the training of reconstructive networks and condenses them into several methods, thus creating a comprehensive framework by selectively utilizing appropriate combinations. Furthermore, we integrate this framework with a reconstruction-based approach and concurrently propose a split training strategy that alleviates the overfitting issue while avoiding introducing interference to the reconstruction process. The evaluations conducted on the MVTec anomaly detection dataset demonstrate that our method outperforms the previous state-of-the-art approach, particularly in terms of object classes. We also generate a simulated dataset comprising anomalies with diverse characteristics, and experimental results demonstrate that our approach exhibits promising potential for generalizing effectively to various unseen anomalies encountered in real-world scenarios.

1. Introduction

In industrial quality inspection, identifying surface anomalies such as scratches, dents, or discolorations is a critical but challenging task due to the inherent rarity of such defects. To train effective deep learning models, researchers typically employ data augmentation to simulate anomalies on normal images. However, current methodologies often suffer from two primary flaws: the "mimicry bias" and the "overfitting gap."

The mimicry bias occurs when models are trained to detect only specific, realistic-looking simulated anomalies, causing them to fail when encountering unpredictable real-world patterns. The overfitting gap arises in two-stage reconstruction models; if the first network becomes too proficient at "fixing" the specific fake anomalies seen during training, it fails to generalize to the slightly different, often blurrier reconstructions produced during actual inference. This paper proposes a comprehensive framework and a novel training strategy to address these limitations.

2. Methods

The proposed solution involves a multi-faceted augmentation suite and a specialized training architecture designed to enhance model sensitivity and robustness.

2.1 Comprehensive Augmentation Framework

Rather than attempting to empirically mimic real-world defects, the authors categorize anomalies by their intrinsic physical nature. The framework defines mathematical formulas for "Transparent" anomalies, which partially obscure the background, and "Opaque" anomalies, which completely replace it.

A significant contribution is the Near-distribution Anomaly Augomaly Augmentation (NDAA). This method uses sine-curve distortions and mask filtering to create anomalies that are visually very similar to the surrounding normal texture. By generating these subtle differences, the model is forced to learn a much tighter and more precise decision boundary for what constitutes "normal."

Overview of the augmentation framework, illustrating the stochastic and optional paths for Rotation, Transparent, Opaque, and NDAA methods.

2.2 Split Training Strategy

To resolve the overfitting gap, the authors introduce a split training strategy that divides normal training data into two disjoint sets based on parity (even vs. odd indices).

  • Set A is used to train the Reconstructive Network, which learns to restore anomalous images to a normal state.
  • Set B is then passed through this restorer. The resulting outputs—which contain the realistic artifacts and blurriness the model will produce at test time—are used to train the Discriminative Network (the detector).

This ensures the detector is trained on the actual distribution of reconstructions it will encounter during real-world testing, rather than idealized versions.

The split training strategy: Set A trains the reconstruction network, while the discriminative network is trained on reconstructions of the unseen Set B.

3. Results and Key Insights

The framework was evaluated against top-tier methods including DRAEM, NSA, and PatchCore on the MVTec AD benchmark. The proposed method achieved an average AUROC of 98.3% and an Average Precision (AP) of 99.3%. Notably, the model excelled in object classes, outperforming the previous state-of-the-art by 2.5% in AP.

3.1 Rejecting Empirical Mimicry

A core philosophical shift in this work is the rejection of "realistic" simulation. The authors argue that since future anomalies are unpredictable, focus should remain on covering the logical possibilities of image corruption (transparency, opacity, and local distortion). This approach proved more stable across diverse anomaly types in custom simulated datasets.

3.2 Sensitivity to Near-Distribution Samples

By utilizing NDAA, the model is forced to learn fine-grained details of the normal distribution. This increased sensitivity allows the model to detect subtle defects that broader augmentation strategies might overlook.

4. Conclusion

This paper introduces a robust framework for surface anomaly detection that mitigates mimicry bias and the overfitting gap. By combining a comprehensive augmentation suite with a parity-based split training strategy, the model achieves state-of-the-art performance, particularly on complex object classes. While the framework currently requires some manual selection of appropriate augmentations per class, it demonstrates significant potential for generalizing to unseen, real-world anomalies.

Summary updated

BibTeX
@inproceedings{lin2024comprehensive,
  author = {Jiang Lin and Yaping Yan},
  title = {{A Comprehensive Augmentation Framework for Anomaly Detection}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=3OmCzIUpcm},
}
Figure