Table of Contents
Fetching ...

Single-Step Reconstruction-Free Anomaly Detection and Segmentation via Diffusion Models

Mehrdad Moradi, Marco Grasso, Bianca Maria Colosimo, Kamran Paynabar

TL;DR

This work tackles the challenge of real-time unsupervised anomaly detection and segmentation in industrial pattered data by removing the reconstruction step inherent to diffusion-based methods. RADAR trains a diffusion U-Net on normal data and, at inference, generates a pixel-level anomaly map from a single forward diffusion step, using patch-based learning to enable low-data and low-memory operation. A compact two-dimensional feature representation from Sobel-filtered noise maps feeds an Isolation Forest to detect anomalies, while Sobel-based edge maps provide precise pixel-level localization. Experiments on 3D-printed materials and MVTec-AD Tile show that RADAR outperforms both reconstruction-based diffusion models and statistical methods in accuracy and F1 score, with substantially improved runtime suitability for real-time manufacturing settings.

Abstract

Generative models have demonstrated significant success in anomaly detection and segmentation over the past decade. Recently, diffusion models have emerged as a powerful alternative, outperforming previous approaches such as GANs and VAEs. In typical diffusion-based anomaly detection, a model is trained on normal data, and during inference, anomalous images are perturbed to a predefined intermediate step in the forward diffusion process. The corresponding normal image is then reconstructed through iterative reverse sampling. However, reconstruction-based approaches present three major challenges: (1) the reconstruction process is computationally expensive due to multiple sampling steps, making real-time applications impractical; (2) for complex or subtle patterns, the reconstructed image may correspond to a different normal pattern rather than the original input; and (3) Choosing an appropriate intermediate noise level is challenging because it is application-dependent and often assumes prior knowledge of anomalies, an assumption that does not hold in unsupervised settings. We introduce Reconstruction-free Anomaly Detection with Attention-based diffusion models in Real-time (RADAR), which overcomes the limitations of reconstruction-based anomaly detection. Unlike current SOTA methods that reconstruct the input image, RADAR directly produces anomaly maps from the diffusion model, improving both detection accuracy and computational efficiency. We evaluate RADAR on real-world 3D-printed material and the MVTec-AD dataset. Our approach surpasses state-of-the-art diffusion-based and statistical machine learning models across all key metrics, including accuracy, precision, recall, and F1 score. Specifically, RADAR improves F1 score by 7% on MVTec-AD and 13% on the 3D-printed material dataset compared to the next best model. Code available at: https://github.com/mehrdadmoradi124/RADAR

Single-Step Reconstruction-Free Anomaly Detection and Segmentation via Diffusion Models

TL;DR

This work tackles the challenge of real-time unsupervised anomaly detection and segmentation in industrial pattered data by removing the reconstruction step inherent to diffusion-based methods. RADAR trains a diffusion U-Net on normal data and, at inference, generates a pixel-level anomaly map from a single forward diffusion step, using patch-based learning to enable low-data and low-memory operation. A compact two-dimensional feature representation from Sobel-filtered noise maps feeds an Isolation Forest to detect anomalies, while Sobel-based edge maps provide precise pixel-level localization. Experiments on 3D-printed materials and MVTec-AD Tile show that RADAR outperforms both reconstruction-based diffusion models and statistical methods in accuracy and F1 score, with substantially improved runtime suitability for real-time manufacturing settings.

Abstract

Generative models have demonstrated significant success in anomaly detection and segmentation over the past decade. Recently, diffusion models have emerged as a powerful alternative, outperforming previous approaches such as GANs and VAEs. In typical diffusion-based anomaly detection, a model is trained on normal data, and during inference, anomalous images are perturbed to a predefined intermediate step in the forward diffusion process. The corresponding normal image is then reconstructed through iterative reverse sampling. However, reconstruction-based approaches present three major challenges: (1) the reconstruction process is computationally expensive due to multiple sampling steps, making real-time applications impractical; (2) for complex or subtle patterns, the reconstructed image may correspond to a different normal pattern rather than the original input; and (3) Choosing an appropriate intermediate noise level is challenging because it is application-dependent and often assumes prior knowledge of anomalies, an assumption that does not hold in unsupervised settings. We introduce Reconstruction-free Anomaly Detection with Attention-based diffusion models in Real-time (RADAR), which overcomes the limitations of reconstruction-based anomaly detection. Unlike current SOTA methods that reconstruct the input image, RADAR directly produces anomaly maps from the diffusion model, improving both detection accuracy and computational efficiency. We evaluate RADAR on real-world 3D-printed material and the MVTec-AD dataset. Our approach surpasses state-of-the-art diffusion-based and statistical machine learning models across all key metrics, including accuracy, precision, recall, and F1 score. Specifically, RADAR improves F1 score by 7% on MVTec-AD and 13% on the 3D-printed material dataset compared to the next best model. Code available at: https://github.com/mehrdadmoradi124/RADAR

Paper Structure

This paper contains 22 sections, 3 equations, 8 figures, 1 table.

Figures (8)

  • Figure 1: Overview of the RADAR anomaly detection framework. After training the diffusion model, each new image is divided into overlapping patches, and the predicted noise maps for these patches are combined to form the full-image noise map. Sobel edge detection is then applied to highlight the edges of anomalous regions. Features are extracted by computing the global L2 norm over the entire noise map and the maximum L2 norm within a sliding window for local anomaly characterization.
  • Figure 2: Forward and backward diffusion processes. The forward process gradually adds noise to an image until it becomes random noise, while the backward process uses a trained neural network to progressively remove the noise and recover the original image structure.
  • Figure 3: DDPM as a noise prediction model. A Gaussian noise and time step are sampled to perturb the image via the forward diffusion process. The noisy image is then passed through a U-Net, which predicts the added noise. The time step is encoded into positional embeddings, processed by a fully connected network, and injected into all U-Net layers.
  • Figure 4: Single-step anomaly map generation. For normal (in-control) data, the trained diffusion model predicts noise that follows a Gaussian distribution due to the Gaussian nature of the forward and backward diffusion processes. In contrast, anomalous patches produce non-Gaussian noise patterns, allowing the model to identify anomalies.
  • Figure 5: U-Net architecture. The network consists of a downsampling block, a middle block, and an upsampling block. Each block integrates attention modules, convolutional layers, and residual connections, which are represented by arrows with a plus sign. Convolution, transposed convolution and multi-head attention pictures were generated by GPT-4o openai_gpt4o_systemcard_2024.
  • ...and 3 more figures