Paper Reading AI Learner

MAGIC: Mask-Guided Diffusion Inpainting with Multi-Level Perturbations and Context-Aware Alignment for Few-Shot Anomaly Generation

2025-07-03 04:54:37
JaeHyuck Choi, MinJun Kim, JeHyeong Hong

Abstract

Few-shot anomaly generation is emerging as a practical solution for augmenting the scarce anomaly data in industrial quality control settings. An ideal generator would meet three demands at once, namely (i) keep the normal background intact, (ii) inpaint anomalous regions to tightly overlap with the corresponding anomaly masks, and (iii) generate anomalous regions in a semantically valid location, while still producing realistic, diverse appearances from only a handful of real examples. Existing diffusion-based methods usually satisfy at most two of these requirements: global anomaly generators corrupt the background, whereas mask-guided ones often falter when the mask is imprecise or misplaced. We propose MAGIC--Mask-guided inpainting with multi-level perturbations and Context-aware alignment--to resolve all three issues. At its core, MAGIC fine-tunes a Stable Diffusion inpainting backbone that preserves normal regions and ensures strict adherence of the synthesized anomaly to the supplied mask, directly addressing background corruption and misalignment. To offset the diversity loss that fine-tuning can cause, MAGIC adds two complementary perturbation strategies: (i) Gaussian prompt-level perturbation applied during fine-tuning and inference that broadens the global appearance of anomalies while avoiding low-fidelity textual appearances, and (ii) mask-guided spatial noise injection that enriches local texture variations. Additionally, the context-aware mask alignment module forms semantic correspondences and relocates masks so that every anomaly remains plausibly contained within the host object, eliminating out-of-boundary artifacts. Under a consistent identical evaluation protocol on the MVTec-AD dataset, MAGIC outperforms previous state-of-the-arts in downstream anomaly tasks.

Abstract (translated)

少量样本异常生成正逐渐成为解决工业质量控制环境中稀缺异常数据问题的一种实用解决方案。理想中的生成器需要同时满足以下三个需求:(i)保持正常的背景不变,(ii)在相应的异常掩码上精确绘制异常区域,以及(iii)在语义有效的位置生成异常区域,并且仅从少量的真实样本中就能产生逼真且多样化的外观。 现有的基于扩散的方法通常最多只能满足上述两个要求:全局异常生成器会破坏背景,而掩模引导的生成方法往往在掩模不精确或定位错误时表现不佳。我们提出了一种名为MAGIC(Mask-guided Inpainting with Multi-level Perturbations and Context-aware Alignment)的技术来解决所有这些问题。MAGIC的核心在于对Stable Diffusion修复模型进行微调,以保留正常区域,并确保合成的异常严格遵循提供的掩模,从而直接解决了背景破坏和不对齐的问题。 为了抵消微调可能带来的多样性损失,MAGIC增加了两种互补的扰动策略:(i)在微调和推理过程中应用高斯提示级扰动,这可以扩展全局异常外观的同时避免低质量的文字表现;以及(ii)掩模引导的空间噪声注入,以丰富局部纹理变化。此外,上下文感知的掩模对齐模块建立了语义对应关系并重新定位掩模,确保每个异常都合理地包含在宿主对象内,从而消除了边界外的伪影。 在MVTec-AD数据集上进行一致且相同的评估协议下,MAGIC在下游异常检测任务中超越了之前的最先进方法。

URL

https://arxiv.org/abs/2507.02314

PDF

https://arxiv.org/pdf/2507.02314.pdf


Tags
3D Action Action_Localization Action_Recognition Activity Adversarial Agent Attention Autonomous Bert Boundary_Detection Caption Chat Classification CNN Compressive_Sensing Contour Contrastive_Learning Deep_Learning Denoising Detection Dialog Diffusion Drone Dynamic_Memory_Network Edge_Detection Embedding Embodied Emotion Enhancement Face Face_Detection Face_Recognition Facial_Landmark Few-Shot Gait_Recognition GAN Gaze_Estimation Gesture Gradient_Descent Handwriting Human_Parsing Image_Caption Image_Classification Image_Compression Image_Enhancement Image_Generation Image_Matting Image_Retrieval Inference Inpainting Intelligent_Chip Knowledge Knowledge_Graph Language_Model LLM Matching Medical Memory_Networks Multi_Modal Multi_Task NAS NMT Object_Detection Object_Tracking OCR Ontology Optical_Character Optical_Flow Optimization Person_Re-identification Point_Cloud Portrait_Generation Pose Pose_Estimation Prediction QA Quantitative Quantitative_Finance Quantization Re-identification Recognition Recommendation Reconstruction Regularization Reinforcement_Learning Relation Relation_Extraction Represenation Represenation_Learning Restoration Review RNN Robot Salient Scene_Classification Scene_Generation Scene_Parsing Scene_Text Segmentation Self-Supervised Semantic_Instance_Segmentation Semantic_Segmentation Semi_Global Semi_Supervised Sence_graph Sentiment Sentiment_Classification Sketch SLAM Sparse Speech Speech_Recognition Style_Transfer Summarization Super_Resolution Surveillance Survey Text_Classification Text_Generation Time_Series Tracking Transfer_Learning Transformer Unsupervised Video_Caption Video_Classification Video_Indexing Video_Prediction Video_Retrieval Visual_Relation VQA Weakly_Supervised Zero-Shot