Introduction
In industrial quality control, identifying surface anomalies like scratches, dents, or missing components is critical. However, because anomalous samples are rare, traditional supervised learning is often impractical. Instead, researchers rely on unsupervised anomaly detection, training models exclusively on "normal" (defect-free) data.
The standard approach is reconstruction-based: a model attempts to "repair" an input image into its normal counterpart. A large discrepancy between the input and the reconstruction signals an anomaly. Despite its intuitive appeal, this approach faces three significant challenges:
- Reconstruction Fidelity: Standard autoencoders often fail to capture complex structural details.
- The "Direct Copy" Problem: High-capacity models may inadvertently reconstruct the anomalies themselves, minimizing the detectable difference.
- Misalignment: Harmless variations in texture or position can lead to false positives at the pixel level.
This paper introduces DiffAD, a framework that leverages Latent Diffusion Models (LDMs) to overcome these hurdles and achieve state-of-the-art performance.
Methods
The DiffAD framework consists of two primary components designed to decouple the reconstruction of normal features from the detection of anomalies.
Reconstructive Sub-network
Unlike traditional autoencoders, DiffAD utilizes a Latent Diffusion Model (LDM). Diffusion models generate high-quality images by iteratively reversing a noise-addition process. To prevent the model from simply copying anomalies (the "direct copy" problem), the authors introduce Noisy Condition Embedding. By encoding the input into a latent space and adding controlled noise before conditioning the diffusion process, the model is forced to rely on global semantic context to "re-imagine" a clean version of the image rather than replicating local defects.
Discriminative Sub-network
Following reconstruction, a U-Net-based discriminative network compares the original input with the generated "normal" version to produce a pixel-level anomaly mask. To address misalignment and harmless texture variations, the authors employ Interpolated Channels. By creating intermediate feature maps that interpolate between the input and the reconstruction, the network learns to distinguish between "normal diversity" (e.g., natural wood grain shifts) and actual structural defects.
Evaluation and Results
The model was evaluated on the MVTec-AD dataset, a benchmark containing 15 categories (5 textures and 10 objects) with over 5,000 high-resolution images and pixel-precise ground truth.
Quantitative Performance
DiffAD demonstrates superior performance across key metrics:
- Detection: Achieved an average 98.7% AUROC, surpassing established baselines like DRAEM (98.0%) and PatchCore (98.1%).
- Localization: The model significantly improves pinpointing accuracy, reaching 98.3% pixel-AUROC and 74.6% Average Precision (AP). The jump in AP from DRAEM’s 68.4% highlights the precision of DiffAD's anomaly masks.
Qualitative Analysis
Visual inspections confirm that DiffAD generates sharp, semantically accurate reconstructions. While competing models often produce blurry or "ghostly" repairs, DiffAD's outputs appear as authentic, defect-free products, facilitating cleaner anomaly detection.
Discussion and Future Work
While DiffAD sets a new standard for localization, some limitations remain. The discriminative sub-network can occasionally be distracted by complex background noise in "object" categories. Additionally, while the use of Latent Diffusion Models improves efficiency, the iterative nature of diffusion processes still presents a challenge for real-time industrial deployment.
Future research directions include integrating attention mechanisms within the discriminative sub-network to better isolate objects of interest from irrelevant background variations.
Summary updated