GLAD: Towards Better Reconstruction with Global and Local Adaptive Diffusion Models for Unsupervised Anomaly Detection

Hang Yao,Ming Liu,Haolin Wang,Zhicun Yin,Zifei Yan,Xiaopeng Hong,Wangmeng Zuo
2024-07-02
Abstract:Diffusion models have shown superior performance on unsupervised anomaly detection tasks. Since trained with normal data only, diffusion models tend to reconstruct normal counterparts of test images with certain noises added. However, these methods treat all potential anomalies equally, which may cause two main problems. From the global perspective, the difficulty of reconstructing images with different anomalies is uneven. Therefore, instead of utilizing the same setting for all samples, we propose to predict a particular denoising step for each sample by evaluating the difference between image contents and the priors extracted from diffusion models. From the local perspective, reconstructing abnormal regions differs from normal areas even in the same image. Theoretically, the diffusion model predicts a noise for each step, typically following a standard Gaussian distribution. However, due to the difference between the anomaly and its potential normal counterpart, the predicted noise in abnormal regions will inevitably deviate from the standard Gaussian distribution. To this end, we propose introducing synthetic abnormal samples in training to encourage the diffusion models to break through the limitation of standard Gaussian distribution, and a spatial-adaptive feature fusion scheme is utilized during inference. With the above modifications, we propose a global and local adaptive diffusion model (abbreviated to GLAD) for unsupervised anomaly detection, which introduces appealing flexibility and achieves anomaly-free reconstruction while retaining as much normal information as possible. Extensive experiments are conducted on three commonly used anomaly detection datasets (MVTec-AD, MPDD, and VisA) and a printed circuit board dataset (PCB-Bank) we integrated, showing the effectiveness of the proposed method.
Computer Vision and Pattern Recognition
What problem does this paper attempt to address?
The paper introduces GLAD (Global and Local Adaptive Diffusion Models), which addresses issues in unsupervised anomaly detection using diffusion models. The primary goal is to improve the reconstruction quality of diffusion models for anomaly detection tasks, specifically focusing on balancing reconstruction quality with detail preservation. ### Problem Statement 1. **Uneven Reconstruction Difficulty**: Different types of anomalies require varying levels of effort to reconstruct. For instance, adding a missing element to an image is more challenging than dealing with a scratch. Current methods treat all anomalies equally, which leads to suboptimal results. 2. **Detail Preservation**: Using a fixed, large number of denoising steps ensures reconstruction but results in the loss of fine details in the original image, affecting the accuracy of anomaly detection. 3. **Local Reconstruction Challenges**: Abnormal regions within an image present unique challenges compared to normal regions. The noise predicted for abnormal regions often deviates from the standard Gaussian distribution, making reconstruction more difficult. ### Proposed Solution #### Global Adaptive Denoising Step (ADP) - **Motivation**: To set an adaptive denoising step for each sample, optimizing the trade-off between reconstruction quality and detail preservation. - **Implementation**: Predict a specific denoising step for each sample by comparing the reconstructed image with the noise-contaminated input. Th