VarAD: Lightweight High-Resolution Image Anomaly Detection via Visual Autoregressive Modeling
Yunkang Cao, Haiming Yao, Wei Luo, Weiming Shen
TL;DR
VarAD tackles high-resolution image anomaly detection by reframing the task as visual token next-token prediction. It combines multi-hierarchy visual tokens from a adapted DINO tokenizer with a multi-directional scanning strategy, and leverages Mamba, a visual autoregressive model, to predict future tokens based on preceding ones, thereby capturing global context with linear complexity. Anomaly scoring relies on prediction discrepancies aggregated across hierarchies and directions, trained solely on normal data. Across four public datasets and a real-world button dataset, VarAD achieves state-of-the-art pixel-level and competitive image-level performance while maintaining lightweight computation, highlighting its potential for practical industrial deployment.
Abstract
This paper addresses a practical task: High-Resolution Image Anomaly Detection (HRIAD). In comparison to conventional image anomaly detection for low-resolution images, HRIAD imposes a heavier computational burden and necessitates superior global information capture capacity. To tackle HRIAD, this paper translates image anomaly detection into visual token prediction and proposes VarAD based on visual autoregressive modeling for token prediction. Specifically, VarAD first extracts multi-hierarchy and multi-directional visual token sequences, and then employs an advanced model, Mamba, for visual autoregressive modeling and token prediction. During the prediction process, VarAD effectively exploits information from all preceding tokens to predict the target token. Finally, the discrepancies between predicted tokens and original tokens are utilized to score anomalies. Comprehensive experiments on four publicly available datasets and a real-world button inspection dataset demonstrate that the proposed VarAD achieves superior high-resolution image anomaly detection performance while maintaining lightweight, rendering VarAD a viable solution for HRIAD. Code is available at \href{https://github.com/caoyunkang/VarAD}{\url{https://github.com/caoyunkang/VarAD}}.
