Lune

CVPR Findings2026

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

JaeHyuck Choi, Minjun Kim, Je Hyeong Hong

Abstract

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 inpaintingbased 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. Code is available at https://github.com/SpatialAILab/MAGIC.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Adding Conditional Control to Text-to-Image Diffusion Models cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Adding Conditional Control to Text-to-Image Diffusion Models cites GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models
  • Adding Conditional Control to Text-to-Image Diffusion Models cites Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
  • One-to-More: High-Fidelity Training-Free Anomaly Generation with Attention Control cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding cites GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. One-to-More: High-Fidelity Training-Free Anomaly Generation with Attention ControlHaoxiang Rao, Zhao Wang, Chenyang Si, Yan Lyu et al.CVPR 2026 · 2 citations

Builds on20

  1. High-Resolution Image Synthesis with Latent Diffusion ModelsRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser et al.CVPR 2022 · 13,123 citations
  2. Photorealistic Text-to-Image Diffusion Models with Deep Language UnderstandingChitwan Saharia, William Chan, Saurabh Saxena, Lala Li et al.NeurIPS 2022 · 8,965 citations
  3. Adding Conditional Control to Text-to-Image Diffusion ModelsLvmin Zhang, Anyi Rao, Maneesh AgrawalaICCV 2023 · 6,759 citations
  4. GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion ModelsAlexander Quinn Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam et al.ICML 2022 · 4,691 citations
  5. Training Generative Adversarial Networks with Limited DataTero Karras, Miika Aittala, Janne Hellsten, Samuli Laine et al.NeurIPS 2020 · 2,345 citations

Related papers

  1. Dual-Interrelated Diffusion Model for Few-Shot Anomaly Image GenerationYing Jin, Jinlong Peng, Qingdong He, Teng Hu et al.CVPR 2025
  2. AnomalyDiffusion: Few-Shot Anomaly Image Generation with Diffusion ModelTeng Hu, Jiangning Zhang, Ran Yi, Yuzhen Du et al.AAAI 2024 · 175 citations
  3. Generate Aligned Anomaly: Region-Guided Few-Shot Anomaly Image-Mask Pair Synthesis for Industrial InspectionYilin Lu, Jianghang Lin, Linhuang Xie, Kai Zhao et al.ACM MM 2025
  4. AnomalyControl: Highly-Aligned Anomalous Image Generation with Controlled Diffusion ModelYuanyi Duan, Wei Xu, Qinlong Wu, Guo-Sen Xie et al.ACM MM 2025 · 3 citations
  5. MagicPaint: Operate Anything for Image Inpainting with Diffusion ModelQinhong Yang, Dongdong Chen, Qi Chu, Tao Gong et al.AAAI 2026
Dusk over the sea between two cliffs drawn in fine vertical lines