Vision transformer improves multi-class anomaly detection in industrial images

Focus and Supplement: Dual-Enhanced Vision Transformer for Multi-Class Anomaly Classification

Computer Vision and Pattern Recognition

Summary

Detecting and categorizing unusual defects in industrial images is hard when the defects look noisy or incomplete, and the number of defect types is unknown. The authors designed a new method called MACO that uses special attention techniques to focus on the important defect regions and multiple complementary tokens to get a complete understanding of the defects. MACO also estimates how many different defect classes there are without needing prior information. Their tests show this approach improves accuracy on standard datasets, especially when the number of defect classes is unknown.

What this means in practice

Authors

Xurui Li, Enjie Xu, Chenzhou Li, Shilei Zeng, Dayou Huang, Tianyi Ma, Yu Zhou

Abstract

Multi-class anomaly classification in industrial vision remains challenging due to noisy/incomplete anomaly representations and the unknown number of anomaly classes. To overcome this, we propose MACO, a novel multi-class anomaly classification framework that learns comprehensive representations and dynamically estimates class number without prior knowledge. First, a soft-focus attention uses anomaly maps to concentrate on relevant abnormal regions, while suppressing background noise. Second, auxiliary classification ([A-CLS]) tokens complement the [CLS] token. They collectively attend to diverse anomaly sub-regions, yielding more holistic and discriminative features. These [A-CLS] tokens are also effective across more tasks and domains. To infer the class number, we propose Correlation-based Number Estimation strategy. It computes the average correlation among labeled classes and transfers its separability cue to the unlabeled set. Experiments on MVTec AD and MTD datasets demonstrate our superiority. Under known class number, MACO improves ARI by 6.5% and $\textbf{16.3%}$ on both datasets, respectively. In the more challenging unknown number scenario, it achieves an $\textbf{11.2%}$ NMI gain on MTD and outperforms existing number estimation strategies by $\textbf{24.1%}$ UPS on MVTec AD. Code will be released at https://github.com/HUST-SLOW/MACO.