Skip to main content
QUICK REVIEW

[Paper Review] Unsupervised Visual Defect Detection with Score-Based Generative Model

Yapeng Teng, Haoyang Li|arXiv (Cornell University)|Nov 29, 2022
Industrial Vision Systems and Defect Detection4 citations
TL;DR

This paper proposes Score-DD, a novel unsupervised visual defect detection method that leverages score-based generative modeling via stochastic differential equations (SDEs) to detect defects by measuring the score (gradient of log probability density) of noisy reconstructions. By using a T-scales strategy to accelerate inference and replacing reconstruction loss with score-based metrics, the method achieves state-of-the-art performance on MVTec AD without requiring labeled anomalies or additional models.

ABSTRACT

Anomaly Detection (AD), as a critical problem, has been widely discussed. In this paper, we specialize in one specific problem, Visual Defect Detection (VDD), in many industrial applications. And in practice, defect image samples are very rare and difficult to collect. Thus, we focus on the unsupervised visual defect detection and localization tasks and propose a novel framework based on the recent score-based generative models, which synthesize the real image by iterative denoising through stochastic differential equations (SDEs). Our work is inspired by the fact that with noise injected into the original image, the defects may be changed into normal cases in the denoising process (i.e., reconstruction). First, based on the assumption that the anomalous data lie in the low probability density region of the normal data distribution, we explain a common phenomenon that occurs when reconstruction-based approaches are applied to VDD: normal pixels also change during the reconstruction process. Second, due to the differences in normal pixels between the reconstructed and original images, a time-dependent gradient value (i.e., score) of normal data distribution is utilized as a metric, rather than reconstruction loss, to gauge the defects. Third, a novel $T$ scales approach is developed to dramatically reduce the required number of iterations, accelerating the inference process. These practices allow our model to generalize VDD in an unsupervised manner while maintaining reasonably good performance. We evaluate our method on several datasets to demonstrate its effectiveness.

Motivation & Objective

  • To address the challenge of unsupervised visual defect detection in industrial settings where defect samples are extremely rare.
  • To overcome the limitation of reconstruction-based methods, where normal pixels are altered during denoising, making pixel-wise reconstruction loss unreliable for anomaly detection.
  • To develop a metric based on the score (gradient of log probability density) that better captures the distance from the normal data distribution’s high-density region.
  • To accelerate inference in score-based models by introducing a T-scales technique that uses multiple short reverse trajectories instead of long single ones.
  • To provide a simple, effective, and plug-and-play solution for unsupervised VDD that does not rely on pre-trained networks, extra data, or complex loss redesign.

Proposed method

  • The method uses a score-based generative model trained solely on normal images via SDEs to iteratively denoise noise into realistic samples.
  • It introduces two reverse processes: 'whole-score' to guide noisy images toward the high-density region of normal data, and 'self-score' to reconstruct original images from noise.
  • The key metric is the score value (gradient of log density) at intermediate steps of the whole-score process, which quantifies how far a sample is from the normal distribution.
  • The T-scales technique selects multiple initial noise levels {t} and runs only a few reverse steps (r) per level, enabling parallel inference and reducing total iterations.
  • Defect localization is achieved by comparing the score values of two noisy versions of the same image—one from whole-score and one from self-score—where higher divergence indicates anomaly.
  • The method avoids reconstruction loss entirely, instead using the score as a principled metric grounded in probability density, which better reflects anomaly severity.

Experimental results

Research questions

  • RQ1Can the score (gradient of log density) of a denoised image serve as a more reliable metric than reconstruction loss for detecting visual defects in unsupervised settings?
  • RQ2Why do normal pixels shift during reconstruction in existing methods, and can this be mitigated by using score-based metrics?
  • RQ3Can the inference speed of score-based models be significantly accelerated without sacrificing detection accuracy?
  • RQ4Does using multiple short reverse trajectories (T-scales) improve detection performance by preserving more original pixel fidelity?
  • RQ5Can a score-based model achieve competitive performance in unsupervised VDD without relying on pre-trained features, external data, or complex loss functions?

Key findings

  • The score-based metric outperforms reconstruction loss in VDD, as shown in ablation studies on MVTec AD, where score-based detection achieves higher AU-ROC than reconstruction loss-based methods.
  • The T-scales technique reduces inference time complexity from O(251) to O(15) on the MVTec AD dataset, making it significantly faster than baseline score-based methods like AnoDDPM.
  • The method achieves competitive performance on MVTec AD without using any labeled anomalies, pre-trained networks, or auxiliary models.
  • Ablation studies confirm that T-scales improves performance by limiting the number of reverse steps per trajectory, thus preserving more original pixel information and reducing distortion of normal regions.
  • The method is robust to distribution shifts in normal data and generalizes well across diverse industrial defect types, as demonstrated on multiple datasets.
  • Despite sensitivity to fixed feature map selection, the method maintains strong performance and can be extended with self-supervised or semi-supervised heads in future work.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.