Abstract
This paper introduces SCADN (Semantic Context based Anomaly Detection Network), a novel unsupervised framework for identifying anomalies by learning to reconstruct missing image regions. Unlike traditional autoencoders that may inadvertently reconstruct anomalous textures, SCADN utilizes a Generative Adversarial Network (GAN) trained with multi-scale striped masks to learn the underlying semantic context of normal data. By treating anomaly detection as an image completion task, the model identifies deviations from expected patterns. Experimental results on MVTec AD, CIFAR-10, MNIST, and a new LaceAD dataset demonstrate that SCADN significantly outperforms existing state-of-the-art methods in both detection and localization.
Introduction
Unsupervised anomaly detection is a critical challenge in computer vision, characterized by an abundance of normal training data and a near-total absence of anomalous examples. Traditional approaches often rely on Deep Autoencoders (DAEs) to learn a compressed representation of normal data, with the expectation that they will fail to reconstruct unseen anomalies. However, DAEs frequently suffer from "over-generalization," where they successfully reconstruct anomalous regions that share local textures with normal data, rendering the anomalies invisible in the resulting error maps.
To address this, the authors propose that a model must understand the semantic context—the structural relationships between different regions of an image. SCADN forces the network to "imagine" missing parts of an image based on their surroundings, preventing simple pixel copying and ensuring the model learns the global and local logic of the normal distribution.
Methodology
SCADN redefines anomaly detection as an image completion task using three primary components:
- Multi-scale Striped Masks: During training, normal images are partially obscured using striped masks of varying widths and orientations (horizontal and vertical). This variety ensures the model learns to predict missing data using context from different spatial scales and directions.
- Adversarial Training: A generator network attempts to reconstruct the masked regions, while a discriminator tries to distinguish between original and reconstructed images. This GAN architecture encourages the production of sharp, realistic textures that adhere to the "normal" training data's distribution.
- Aggregated Inference: At test time, an image is processed through multiple mask configurations. The model generates several error maps, which are then merged using a distance-from-mean calculation to highlight significant discrepancies across all scales.
Datasets
The performance of SCADN was validated across four diverse datasets:
- MVTec AD: The industry standard for anomaly detection, featuring various industrial objects and textures.
- CIFAR-10 & MNIST: Benchmarks used to test the model's ability to generalize to object-based anomalies.
- LaceAD: A new, high-resolution dataset introduced by the authors containing 9,176 images of lace fabric. Lace is particularly challenging due to its complex, repetitive semantic structures where defects like broken threads are highly subtle.
Experimental Results
SCADN demonstrated superior performance across all benchmarks. On the challenging LaceAD dataset, it achieved a mean AUC of 0.898, a substantial improvement over the previous state-of-the-art, MemAE (0.756). On MVTec AD, it reached a mean AUC of 0.818 for detection and 0.752 for pixel-level segmentation.
Key insights from the results include:
- Contextual Logic: By forcing reconstruction, the model learns structural rules (e.g., a floral pattern should be adjacent to a mesh pattern) rather than just local textures.
- Robustness of Stripes: Striped masks provide more consistent boundary information than block masks, aiding the learning of global dependencies.
- Multi-scale Effectiveness: Small masks detect minute defects, while larger masks identify structural irregularities, with aggregation providing overall robustness.
Conclusion
SCADN effectively leverages semantic context to overcome the limitations of traditional reconstruction-based anomaly detection. While the model is highly effective, the authors note that "Aggregated Inference" increases computational cost due to multiple passes per image. Future research may focus on optimizing mask selection or extending this contextual approach to temporal data in video-based anomaly detection.
Summary updated