Diffusion with Awareness: An Adaptive Framework for Multi-class Anomaly Detection
摘要
Multi-class anomaly detection in industrial settings presents unique challenges, such as poor generalization across diverse categories and the presence of dynamic reconstruction bias. To address these issues, we propose DADF, a novel Diffusion with Awareness framework that integrates adaptive parameter modulation, localized anomaly synthesis, and feature-space suppression for robust and precise detection. Specifically, we design an Adaptive Diffusion Parameter Module that extracts semantic, texture, and edge representations from normal images using a pretrained vision model, and dynamically modulates noise levels and timestep schedules to enable category-aware reconstruction. To enhance anomaly diversity and localization, we introduce a Localized Diffusion Anomaly Module (LDAM) that perturbs spatially constrained latent regions, generating realistic pseudo-anomalies as supervision signals. Additionally, an Anomaly Suppression Module incorporates a two-layer projection head with feature-space constraints—including cosine reconstruction loss, L2 regularization, and contrastive margin loss—to align pseudo-anomalous features with normal patterns and mitigate residual anomaly leakage. At inference, pixel-level anomaly maps are computed via multi-scale cosine similarity between input and diffusion-based reconstruction. Extensive experiments on MVTec-AD, VisA, BTAD, and MPDD benchmarks demonstrate that DADF consistently outperforms prior methods at both image- and pixel-level tasks. Ablation studies further validate the complementary effects of our adaptive and generative components.