A Unified Anomaly Synthesis Strategy with Gradient Ascent for Industrial Anomaly Detection and Localization

Qiyu Chen, Huiyuan Luo, Chengkan Lv, Zhengtao Zhang

In the world of automated industrial inspection, finding defects is often a game of "spot the difference" where the differences are incredibly subtle. While deep learning has made huge strides in anomaly detection, identifying "weak defects"—those tiny scratches or low-contrast blemishes that look almost exactly like normal material—remains a major hurdle.

A new paper, "A Unified Anomaly Synthesis Strategy with Gradient Ascent for Industrial Anomaly Detection and Localization," introduces a framework called GLASS that tackles this head-on by intelligently "dreaming up" the hardest possible defects to train against.

TL;DR

The researchers propose GLASS (Global and Local Anomaly co-Synthesis Strategy), a framework that uses gradient ascent and truncated projection to synthesize realistic, subtle anomalies at the feature level. By combining these "near-in-distribution" synthetic defects with traditional image-level textures, GLASS achieves a near-perfect 99.9% AUROC on the MVTec AD benchmark and sets new records for detecting weak industrial defects.

What Problem Does This Paper Address?

Most industrial anomaly detection is unsupervised because real-world defects are rare and expensive to label. To train models, researchers often synthesize "fake" anomalies. However, current methods have two big flaws:

  1. Lack of Controllability: Adding random noise to features or pasting random textures onto images creates anomalies that are often "too easy" for the model to spot.
  2. The "Weak Defect" Gap: They fail to generate anomalies that sit right on the edge of the normal distribution—the subtle, low-contrast defects that are most likely to be missed in a real factory setting.
Fig. 1: Process flow and visualization of various anomaly synthesis strategies. (a) Image-level anomaly synthesis strategy (gray triangles) provides detailed textures but lacks diversity. (b) Feature-level anomaly synthesis strategy (pink diamonds) is more efficient but lacks directionality. (c) Our method (blue squares) controls the distribu- tion of synthetic anomalies at image and feature levels by using gradient ascent.

Methods

The GLASS framework operates through three parallel branches during training:

  1. Normal Branch: Processes standard, defect-free images through a frozen backbone (like WideResNet50) and a trainable "feature adaptor" to learn the baseline distribution.
  2. Global Anomaly Synthesis (GAS): This is the core innovation. It operates in the feature space. It takes normal features, adds a tiny bit of Gaussian noise, and then uses gradient ascent to push those features toward the classification boundary. A truncated projection step ensures these synthetic anomalies don't wander too far away, keeping them "weak" and challenging for the model.
  3. Local Anomaly Synthesis (LAS): This branch works at the image level. It overlays external textures onto normal images using Perlin noise masks to simulate "strong," localized defects like holes or large stains.
Fig. 2: Schematic of the proposed GLASS. The training phase comprises three branches: (a) Normal branch obtains adapted normal features through a feature extrac- tor and a feature adaptor. (b) GAS branch synthesizes global anomaly features from normal features in three steps based on gradient guidance. (c) LAS branch synthesizes local anomaly images from normal images in three steps based on texture overlay.

The system is trained end-to-end to distinguish normal features from both GAS (subtle/global) and LAS (obvious/local) synthetic features.

Datasets

The authors evaluated GLASS on three standard public benchmarks: MVTec AD, VisA, and MPDD.

To specifically test weak defect detection, they introduced three new benchmarks:

  • WFDD (Woven Fabric Defect Detection): A self-built dataset of 4,101 industrial fabric images with real-world defects.
  • MAD-man: A subset of MVTec AD where humans manually selected the most difficult, subtle defects.
  • MAD-sys: A synthetic test set where the "weakness" of defects is mathematically controlled via transparency.

Key Insights and Ideas

  • Gradient Ascent as a "Hard Negative" Generator: Instead of hoping random noise creates a challenging sample, GLASS explicitly uses the model's own loss function to find the most confusing synthetic anomalies. This forces the discriminator to learn a much tighter and more precise classification boundary.
  • Distribution Hypotheses: The authors recognize that different industrial objects have different data structures. They implement GAS using two different geometric assumptions: the Manifold Hypothesis (for complex, non-linear textures) and the Hypersphere Hypothesis (for compact, uniform objects). They use image-level spectrogram analysis to automatically choose the best fit for a given category.
Schematic of GAS under Manifold and Hypersphere hypotheses, showing how truncated projection keeps synthetic anomalies in the "sweet spot" near the normal distribution.
  • Complementary Synthesis: GAS and LAS work together. GAS handles the "near-in-distribution" anomalies that look like normal features, while LAS ensures the model can still handle "far-from-distribution" anomalies with distinct textures.

Key Results

  • State-of-the-Art Performance: GLASS achieved a staggering 99.9% image-level AUROC on MVTec AD, outperforming previous leaders like PatchCore and SimpleNet.
  • Weak Defect Mastery: On the challenging MAD-sys dataset, GLASS outperformed the previous best method (SimpleNet) by 11% AUROC (95.6% vs 84.6%).
  • Industrial Speed: Despite the sophisticated synthesis, the model maintains a throughput of 1,327 images per second, making it highly practical for high-speed production lines.

Limitations and Future Work

While GLASS excels at structural and textural defects, the authors note it hasn't been extensively tested on logical anomalies (e.g., a machine part that has all the right components but in the wrong order). Additionally, the LAS branch still relies on an external texture dataset (DTD). Future work will look into generating these local textures internally to create a completely self-contained synthesis pipeline.

Paper Citation: Qiyu Chen, Huiyuan Luo, Chengkan Lv, and Zhengtao Zhang. "A Unified Anomaly Synthesis Strategy with Gradient Ascent for Industrial Anomaly Detection and Localization." arXiv:2407.09359v1 [cs.CV] 12 Jul 2024.

Summary updated

Abstract

Anomaly synthesis strategies can effectively enhance unsupervised anomaly detection. However, existing strategies have limitations in the coverage and controllability of anomaly synthesis, particularly for weak defects that are very similar to normal regions. In this paper, we propose Global and Local Anomaly co-Synthesis Strategy (GLASS), a novel unified framework designed to synthesize a broader coverage of anomalies under the manifold and hypersphere distribution constraints of Global Anomaly Synthesis (GAS) at the feature level and Local Anomaly Synthesis (LAS) at the image level. Our method synthesizes near-in-distribution anomalies in a controllable way using Gaussian noise guided by gradient ascent and truncated projection. GLASS achieves state-of-the-art results on the MVTec AD (detection AUROC of 99.9\%), VisA, and MPDD datasets and excels in weak defect detection. The effectiveness and efficiency have been further validated in industrial applications for woven fabric defect detection. The code and dataset are available at: \url{https://github.com/cqylunlun/GLASS}.
BibTeX
@inproceedings{chen2024unified,
  author = {Qiyu Chen and Huiyuan Luo and Chengkan Lv and Zhengtao Zhang},
  title = {{A Unified Anomaly Synthesis Strategy with Gradient Ascent for Industrial Anomaly Detection and Localization}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72855-6\_3},
}
Figure