Research map / Image generation / Fast diffusion sampling
AnomalyDiffusion: Few-Shot Anomaly Image Generation with Diffusion Model
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes AnomalyDiffusion, a few-shot latent-diffusion method that generates anomaly image-mask pairs for MVTec by disentangling anomaly appearance (learned embedding) from location (mask-encoded spatial embedding), with an adaptive attention re-weighting step to align anomalies with masks.
Problem
Few-shot anomaly image generation for industrial inspection: existing model-free and GAN-based methods produce unauthentic anomalies or anomalies misaligned with their masks, limiting downstream anomaly detection and localization.
Approach
Decompose the textual condition into a learned anomaly-appearance embedding and a spatial embedding encoded from the anomaly mask, and dynamically re-weight cross-attention during denoising using pixel differences between the predicted clean image and the normal sample so that weakly generated regions inside the mask receive more attention.
Key results
- Pixel-level anomaly localization on MVTec with a U-Net trained on generated data reaches 99.1% AUROC and 81.4% AP, versus 96.9% / 66.2% for PRN and 90.0% / 62.7% for DFMGAN.
- Average IS of 1.80 and IC-LPIPS of 0.32 on MVTec, best among compared anomaly generators (DFMGAN 1.72 / 0.20).
- Anomaly classification accuracy with a ResNet-18 trained on generated data averages 66.09%, versus 49.61% for DFMGAN.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Add Spatial Anomaly Embedding, masked diffusion loss, and adaptive attention re-weighting (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AUROC: 81.3 -> 99.1 | Helped |
| Add Spatial Anomaly Embedding, masked diffusion loss, and adaptive attention re-weighting (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 31.1 -> 81.4 | Helped |
| Add Spatial Anomaly Embedding to anomaly embedding-only model (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AUROC: 81.3 -> 90.3 | Helped |
| Add masked diffusion loss to SAE (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AUROC: 90.3 -> 95.0 | Helped |
| Add AAR to SAE and masked diffusion loss (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AUROC: 95.0 -> 99.1 | Helped |
| Reduce anomaly training-data rate from 30% to 10% (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 81.4 -> 64.2 | Hurt |
| Reduce anomaly training-data rate from 30% to 20% (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 81.4 -> 75.5 | Hurt |
| Increase anomaly training-data rate from 30% to 40% (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 81.4 -> 81.1 | No clear effect |
| Increase anomaly training-data rate from 30% to 50% (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 81.4 -> 80.0 | Hurt |
| Increase spatial embedding and anomaly embedding lengths (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 81.4; 80.6; 80.9; 81.2 | No clear effect |
| Replace Spatial Anomaly Embedding with Textual Inversion + Prompt-to-Prompt (ablation) | AnomalyDiffusion · MVTec pixel-level localization | AP: 81.4 -> 55.1 | Hurt |
| Use AnomalyDiffusion-generated data instead of DFMGAN-generated data | ResNet-18 anomaly classification · MVTec anomaly classification | accuracy: 49.61 -> 66.09 | Helped |
Surprising findings
- Textual inversion alone tends to bind anomalies to the training locations, so the spatial embedding is needed to control position.
- Adding the attention re-weighting without spatial embedding fills masks but reduces authenticity, per the appendix ablation.
Limitations
- Generation is limited to low resolution; the authors note a more potent diffusion model would be needed for higher-resolution anomalies.
- Evaluated only on MVTec, with a limited number of training anomalies (one-third of anomaly data, often 1-2 instances per category).
- Classification and detection comparisons use a simple U-Net and ResNet, so downstream gains depend on those choices.
Experimental setup
Datasets: MVTec
Benchmarks: MVTec
Metrics: IS IC-LPIPS AUROC AP F1-max PRO classification accuracy
Baselines: DiffAug CDC Crop&Paste SDGAN Defect-GAN DFMGAN DRAEM PRN DevNet DRA CFLOW CFA
Builds on: latent diffusion model textual inversion blended latent diffusion DFMGAN
Closest papers by meaning
- Dual-Interrelated Diffusion Model for Few-Shot Anomaly Image Generation (CVPR 2025 · similarity 0.95)
- Unseen Visual Anomaly Generation (CVPR 2025 · similarity 0.90)
- Correcting Deviations from Normality: A Reformulated Diffusion Model for Multi-Class Unsupervised Anomaly Detection (CVPR 2025 · similarity 0.90)
- A Diffusion-Based Framework for Multi-Class Anomaly Detection (AAAI 2024 · similarity 0.89)
- DZAD: Diffusion-based Zero-shot Anomaly Detection (AAAI 2025 · similarity 0.88)
- One-to-Normal: Anomaly Personalization for Few-shot Anomaly Detection (NeurIPS 2024 · similarity 0.88)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
