Learning to Detect Multi-class Anomalies with Just One Normal Image Prompt

Bin-Bin Gao
5/14/2025
41 citations
cs.CVcs.AI
transformer-attention

Official code: gaobb/OneNIP (80 stars, Python, last commit 2026-01-18).

Abstract

Unsupervised reconstruction networks using self-attention transformers have achieved state-of-the-art performance for multi-class (unified) anomaly detection with a single model. However, these self-attention reconstruction models primarily operate on target features, which may result in perfect reconstruction for both normal and anomaly features due to high consistency with context, leading to failure in detecting anomalies.

Show full abstract

Additionally, these models often produce inaccurate anomaly segmentation due to performing reconstruction in a low spatial resolution latent space. To enable reconstruction models enjoying high efficiency while enhancing their generalization for unified anomaly detection, we propose a simple yet effective method that reconstructs normal features and restores anomaly features with just One Normal Image Prompt (OneNIP). In contrast to previous work, OneNIP allows for the first time to reconstruct or restore anomalies with just one normal image prompt, effectively boosting unified anomaly detection performance. Furthermore, we propose a supervised refiner that regresses reconstruction errors by using both real normal and synthesized anomalous images, which significantly improves pixel-level anomaly segmentation. OneNIP outperforms previous methods on three industry anomaly detection benchmarks: MVTec, BTAD, and VisA. The code and pre-trained models are available at https://github.com/gaobb/OneNIP.

View on arXivView PDF

Code Implementations(1)

gaobb/OneNIPOfficial100%

[ECCV 2024] Learning to Detect Multi-class Anomalies with Just One Normal Image Prompt

804Python, ShellJul 10, 202410 months ago
anomaly-detectionmulti-class-anomaly-detection

Similar Papers

Cite this paper

@article{gao2025learning,
  title  = {Learning to Detect Multi-class Anomalies with Just One Normal Image Prompt},
  author = {Bin-Bin Gao},
  year   = {2025},
  eprint = {2505.09264},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.09264v1},
  journal = {ECCV 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.09264.svg)](https://codeofpaper.com/paper/2505.09264)

Discussion