Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

MAGIC: Few-Shot Mask-Guided Anomaly Inpainting with Prompt Perturbation, Spatially Adaptive Guidance, and Context Awareness

About

Few-shot anomaly generation is a key challenge in industrial quality control. Although diffusion models are promising, existing methods struggle: global prompt-guided approaches corrupt normal regions, and existing inpainting-based methods often lack the in-distribution diversity essential for robust downstream models. We propose MAGIC, a fine-tuned inpainting framework that generates high-fidelity anomalies that strictly adhere to the mask while maximizing this diversity. MAGIC introduces three complementary components: (i) Gaussian prompt perturbation, which prevents model overfitting in the few-shot setting by learning and sampling from a smooth manifold of realistic anomalies, (ii) spatially adaptive guidance that applies distinct guidance strengths to the anomaly and background regions, and (iii) context-aware mask alignment to relocate masks for plausible placement within the host object. Under consistent identical evaluation protocol, MAGIC outperforms state-of-the-art methods on diverse anomaly datasets in downstream tasks

JaeHyuck Choi, MinJun Kim, Je Hyeong Hong• 2025

Related benchmarks

TaskDatasetResultRank
Anomaly LocalizationMVTec-AD (test)
Pixel AUROC99.8
211
Anomaly GenerationMVTec AD
KID40.27
85
Image-level Anomaly DetectionMVTec AD
AUROC99.36
82
Image-level Anomaly DetectionVisA
AUC94.28
80
Anomaly GenerationVisA
IC-LPIPS32
62
Anomaly ClassificationMVTec-AD (test)--
50
Anomaly LocalizationVisA--
35
Image-level Anomaly DetectionDAGM
AUROC99.86
33
Anomaly GenerationMVTec-AD (test)
IC-LPIPS0.13
33
Anomaly LocalizationMVTec 3D-AD--
29
Showing 10 of 19 rows

Other info

Follow for update