Abstract
To efficiently deploy strong, often pre-trained feature extractors, recent Industrial Anomaly Detection and Segmentation (IADS) methods process low-resolution images, e.g., 224x224 pixels, obtained by downsampling the original input images. However, while numerous industrial applications demand the identification of both large and small defects, downsampling the input image to a low resolution may hinder a method's ability to pinpoint tiny anomalies. We propose a novel Teacher--Student paradigm to leverage strong pre-trained features while processing high-resolution input images very efficiently. The core idea concerns training two shallow MLPs (the Students) by nominal images so as to mimic the mappings between the patch embeddings induced by the self-attention layers of a frozen vision Transformer (the Teacher). Indeed, learning these mappings sets forth a challenging pretext task that small-capacity models are unlikely to accomplish on out-of-distribution data such as anomalous images. Our method can spot anomalies from high-resolution images and runs way faster than competitors, achieving state-of-the-art performance on MVTec AD and the best segmentation results on VisA. We also propose novel evaluation metrics to capture robustness to defect size, i.e., the ability to preserve good localisation from large anomalies to tiny ones. Evaluating our method also by these metrics reveals its neatly superior performance.
Introduction: The Resolution-Speed Bottleneck
Industrial Anomaly Detection and Segmentation (IADS) aims to identify defects like scratches or missing components using only "normal" training data. A significant challenge in this field is the trade-off between image resolution and processing speed. Most state-of-the-art methods downsample images to $224 \times 224$ pixels to maintain real-time performance. However, in industrial settings, defects can be extremely small. Downsampling often causes these tiny anomalies to vanish or blur, making them impossible to detect. Conversely, processing high-resolution images with complex backbones is typically too slow for high-speed production lines.
Proposed Method: Efficient Teacher-Student Paradigm
We introduce a high-speed Teacher-Student framework designed to handle megapixel images efficiently. The architecture consists of a frozen, pre-trained Vision Transformer (DINO-v2) as the Teacher and two shallow Multi-Layer Perceptrons (MLPs) as the Students ($S_F$ and $S_B$).
Contextualization as a Pretext Task
Unlike standard distillation, our students are trained to mimic the internal mappings of the Transformer. Specifically, the forward student ($S_F$) predicts deep layer features from shallow ones, while the backward student ($S_B$) does the reverse. These mappings represent how the Transformer "contextualizes" local patches into global structures. While small MLPs can learn this relationship for normal data, they fail to generalize to anomalous, out-of-distribution data.
Speed through Patch-Independence
Because the Student MLPs process each patch embedding independently, the computational cost scales linearly with the number of patches. This allows the model to scale to high resolutions ($1036 \times 1036$) without the quadratic slowdown associated with standard self-attention mechanisms.
Experimental Results
The method was evaluated on the MVTec AD and VisA benchmarks. VisA is particularly challenging due to its complex structures and high proportion of tiny defects.
Performance and Speed
Our approach achieves state-of-the-art results while maintaining "blazing" speed. It processes $1036 \times 1036$ images in approximately 1.78ms on an NVIDIA RTX 4090, making it roughly 35x faster than competitors like EfficientAD (63ms). On the VisA dataset, the method achieved an AUPRO@30% of 0.952, significantly outperforming prior methods like PatchCore and SimpleNet.
Robustness to Defect Size
We propose a new Robustness metric ($\rho$) to measure how well a model handles anomalies of varying sizes. In the smallest quartile of defects ($Q_1$), our method significantly outperforms existing approaches. On VisA, it achieved a $Q_1$-AUPRO@5% of 0.730, compared to 0.484 for PatchCore.
Conclusion and Limitations
By training shallow MLPs to mimic the internal logic of a Vision Transformer, we enable high-resolution anomaly detection at unprecedented speeds. While the method is highly effective, it can be sensitive to "unseen" background noise (like dust) and the output anomaly map resolution is currently limited by the backbone's patch size. Future work will explore feature upsampling to produce even denser anomaly maps.
Summary updated