NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Not All Regions Are Equal: Attention-Guided Perturbation Network for Industrial Anomaly Detection

Tingfeng Huang, Yuxuan Cheng, Jingbo Xia, Rui Yu, Yuxuan Cai, Jinhai Xiang, Xinwei He · DOI

TL;DR

AGPNet introduces a smarter way to train anomaly detection models by moving away from uniform, "one-size-fits-all" noise injection. By using an attention-guided perturbation strategy, the model focuses its learning efforts on critical foreground regions, effectively preventing the "identical shortcut" problem where models accidentally learn to reconstruct defects instead of flagging them.

What Problem Does This Paper Address?

In the world of industrial quality control, "reconstruction-based" models are a popular choice for unsupervised anomaly detection. The logic is simple: train a model to reconstruct normal images perfectly; when it encounters a defect (an anomaly) during testing, it should fail to reconstruct it, creating a high "error" that signals a problem.

However, deep neural networks are often too good at their jobs. They frequently develop an "identical shortcut," where they learn to reconstruct any input—including anomalies—with high fidelity. To stop this, researchers often "perturb" (add noise to) training images to force the model to learn the underlying patterns of "normality." The catch? Most existing methods apply noise uniformly across the entire image. This is inefficient because, in industrial settings, the background is often irrelevant. Perturbing a blank corner of a tray doesn't help the model learn the complex geometry of the screw sitting in the middle.

Methods

The authors propose the Attention-Guided Perturbation Network (AGPNet), which consists of two main components:

  1. The Reconstruction Branch: This is the core model (a lightweight Vision Transformer decoder) that learns to take a noisy input and output a clean, "normal" version of the features. It uses a frozen DINO (ViT-S-16) backbone as a feature extractor.
  2. The Auxiliary Perturbation Branch: This is the "brain" behind the noise. It generates a sample-aware attention mask to decide where to add noise. This mask is a fusion of two sources:
  3. Prior Attention: Derived from the pre-trained DINO backbone, which naturally highlights foreground objects.
  4. Learnable Attention: Derived from a "Mean Teacher" version of the decoder (using Exponential Moving Average). This captures which regions are currently most important for the reconstruction task itself.

The "Easy-to-Hard" Strategy: AGPNet doesn't just dump noise on the model from day one. It uses a noise intensity parameter ($\alpha$) that increases linearly as training progresses. This allows the model to learn basic structures first before being challenged with heavily corrupted "hard" samples.

Datasets

The researchers evaluated AGPNet on three gold-standard benchmarks for industrial anomaly detection:

  • MVTec-AD: 15 categories of industrial objects and textures.
  • VisA: A challenging dataset featuring complex structures and multiple objects.
  • MVTec-3D: A dataset of 3D scans (though this paper focused specifically on the RGB image data).

Key Insights and Ideas

  • Not All Pixels are Equal: The central "aha" moment is that perturbing foreground regions (the actual object) is far more effective for representation learning than perturbing the background.
  • Dual-Domain Attention: By combining a frozen "prior" (DINO) with a "learnable" mask (Mean Teacher), the model balances general object knowledge with task-specific focus.
  • Feature-Level vs. Image-Level Noise: The paper finds that adding noise to the latent features is often more effective than just adding it to the raw pixels, as it forces the decoder to reason about high-level semantic patterns.
  • Efficiency by Design: The auxiliary branch used to generate masks is only used during training. At inference (testing) time, it is discarded, meaning AGPNet remains extremely fast and lightweight for real-world deployment.

Key Results

AGPNet achieved state-of-the-art (SOTA) results across multiple categories:

  • Multi-Class Performance: On MVTec-AD, it achieved 98.7% I-AUC (Image-level) and 98.0% P-AUC (Pixel-level), outperforming established models like UniAD and ViTAD.
  • Few-Shot Learning: Even when trained on only 1, 2, or 4 normal samples, AGPNet remained highly competitive. In the 4-shot setup on MVTec-AD, it reached 97.3% P-AUC, setting a new benchmark for localization.
  • Speed and Scale: Despite its high accuracy, the model is efficient, running at 326 FPS on an NVIDIA RTX 4090, making it viable for high-speed assembly line integration.

Limitations and Future Work

The authors acknowledge that like most unsupervised methods, AGPNet is sensitive to "noisy" training data. If the training set accidentally contains anomalous samples (defects), the model might learn them as "normal."

Additionally, while the model excels at industrial images, the authors suggest that its performance in other domains—such as medical imaging (e.g., finding tumors) or video anomaly detection—requires further investigation. Future iterations may also look into more complex noise types beyond Gaussian distributions to better simulate real-world sensor artifacts.

Summary updated

BibTeX
@misc{huang2024not,
  author = {Tingfeng Huang and Yuxuan Cheng and Jingbo Xia and Rui Yu and Yuxuan Cai and Jinhai Xiang and Xinwei He},
  title = {{Not All Regions Are Equal: Attention-Guided Perturbation Network for Industrial Anomaly Detection}},
  year = {2024},
  eprint = {2408.07490},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.07490},
}
Figure