Neighborhood Attention-based Feature Reconstruction for Image Anomaly Detection and Localization
Abstract
With the advancement of machine vision technology, automated vision inspection systems are needed in broad quality control scenarios. This article proposes a neighborhood attention-based feature reconstruction method for image anomaly detection and localization (NAFRAD). To address the challenges of data scarcity, low visibility, and irregular defect shapes in unsupervised anomaly detection, we introduce a feature reconstruction framework that preserves high-level abstract features rather than focusing on pixel-level reconstruction. This approach enhances model robustness and generalizability by leveraging neighborhood attention (NA) mechanisms, which simultaneously capture local details and the global context through a sliding window strategy. The NA-based autoencoder reconstructs normal features by aggregating local inductive biases with translational equivariance, enabling precise anomaly localization. Extensive experiments on the MVTec Anomaly Detection (MVTec AD) dataset—comprising 15 categories with 5,354 images—demonstrate the superiority of NAFRAD. It achieves state-of-the-art performance with AUROC \({}_{I}\) = 99.02, AUROC \({}_{P}\) = 98.99, and AP = 79.40, outperforming existing methods by 3.6% in AP and 0.89% in AUROC \({}_{P}\) . The framework’s effectiveness is validated through ablation studies, visualization of feature reconstruction, and comparisons with eight leading unsupervised methods. The code is made public at https://github.com/Math-Computer/NAFRAD .
Fields of Study & Subjects
Anomaly Detection Techniques and Applications
Adversarial Robustness in Machine Learning
Advanced Neural Network Applications
Publication details
- Journal / source
- ACM Transactions on Multimedia Computing Communications and Applications
- Volume
- 22
- Issue
- 3
- Pages
- 1–20
- Publication date
- 5 January 2026
- Language
- EN