TL;DR
This paper introduces AnoGen, a novel few-shot anomaly generation method that leverages diffusion models to create realistic and semantically consistent anomalies from just a few real examples. By guiding a pre-trained diffusion model with learned embeddings and bounding boxes, AnoGen generates synthetic anomalies that significantly improve the performance of downstream anomaly detection and segmentation tasks, bridging the gap between synthetic and real-world anomalies.
What Problem Does This Paper Address?
Anomaly detection, particularly in industrial settings, is hampered by the extreme scarcity of anomalous data. This makes it challenging to train robust models for tasks like quality inspection. Existing methods often resort to synthesizing anomalies using noise or external datasets, but these synthetic anomalies suffer from a significant "semantic gap" with real-world anomalies, leading to suboptimal performance. This paper tackles the problem of generating realistic, diverse, and semantically aligned anomalies using only a handful of real anomaly examples, thereby enabling better training of anomaly detection models.
Methods
The proposed AnoGen method operates in three stages:
- Learn Anomaly Embedding: Instead of fine-tuning the entire diffusion model (which is computationally expensive and requires lots of data), AnoGen learns a compact embedding vector. This embedding captures the semantic characteristics of a few "support anomalies" (real anomaly examples). The pre-trained diffusion model's parameters are frozen, and only this embedding is optimized.
- Guiding Image Generation: The learned embedding is then used to guide a pre-trained Latent Diffusion Model (LDM) to generate new anomalies. This generation process is conditioned on a normal image and a bounding box mask, allowing for control over the anomaly's location and size. This bounding box also serves as a weak supervision signal for downstream tasks.
- Weakly-Supervised Anomaly Detection: Finally, the generated anomalies, along with their bounding box masks, are used to train discriminative anomaly detection models (like DRAEM and DeSTSeg). A novel weakly-supervised loss is introduced to handle the imprecision of bounding box masks, effectively filtering out high-confidence normal pixels within the box to prevent misclassification.
Datasets
The primary dataset used for evaluation is MVTec AD. This dataset is a standard benchmark for industrial anomaly detection, containing 10 objects and 5 textures with various types of anomalies. The authors generated a large synthetic dataset of 70,760 images for training their models.
Key Insights and Ideas
- Few-Shot Generation is Key: The core idea is that even a few real anomalies can provide enough semantic information to guide a powerful generative model (like diffusion models) to produce more realistic synthetic anomalies than methods relying on external data or noise.
- Embedding as a Compact Representation: Learning a small embedding vector is a more efficient and effective way to condition a diffusion model for anomaly generation than trying to fine-tune the entire model, especially with limited data.
- Bounding Boxes as Dual-Purpose Supervision: The bounding boxes used to control anomaly generation also serve as a crucial weak supervision signal for training anomaly segmentation models, simplifying the process compared to requiring precise pixel-level masks.
- Bridging the Semantic Gap: The generated anomalies are semantically consistent with real-world anomalies, which is critical for improving the performance of downstream anomaly detection models, especially for segmentation tasks where precise localization is important.
Key Results
- AnoGen significantly improves the performance of existing anomaly detection models like DRAEM and DeSTSeg.
- On the MVTec dataset, DRAEM achieved a 5.8% improvement in pixel-level AU-PR, and DeSTSeg achieved a 1.5% improvement in pixel-level AU-PR when trained with AnoGen-generated anomalies.
- Image-level AU-ROC also saw improvements, with DRAEM gaining 1.6% and DeSTSeg 0.5%.
- Qualitative results show that AnoGen generates diverse and realistic anomalies that are spatially controllable.
Limitations and Future Work
- Bounding Box Limitations: The generated anomalies are annotated with bounding boxes, not precise pixel-level masks. This necessitates the use of weakly-supervised methods for training segmentation models, which can introduce additional hyperparameters.
- Future Work: The authors aim to explore methods for generating more precise annotations (e.g., pixel-level masks) for the anomalies, which would make them more readily usable for standard supervised anomaly detection tasks. They also suggest that further research could explore how to obtain more precise annotations when generating anomaly images.
Summary updated