[Paper Review] HaloAE: An HaloNet based Local Transformer Auto-Encoder for Anomaly Detection and Localization
HaloAE proposes a novel local Transformer auto-encoder using HaloNet's block-wise self-attention to jointly perform unsupervised anomaly detection and localization. By combining local self-attention with convolutional feature extraction and self-supervised learning, it achieves state-of-the-art performance on the MVTec benchmark, with 91.4% mean image-level and 91.2% pixel-wise ROC-AUC scores.
Unsupervised anomaly detection and localization is a crucial task as it is impossible to collect and label all possible anomalies. Many studies have emphasized the importance of integrating local and global information to achieve accurate segmentation of anomalies. To this end, there has been a growing interest in Transformer, which allows modeling long-range content interactions. However, global interactions through self attention are generally too expensive for most image scales. In this study, we introduce HaloAE, the first auto-encoder based on a local 2D version of Transformer with HaloNet. With HaloAE, we have created a hybrid model that combines convolution and local 2D block-wise self-attention layers and jointly performs anomaly detection and segmentation through a single model. We achieved competitive results on the MVTec dataset, suggesting that vision models incorporating Transformer could benefit from a local computation of the self-attention operation, and pave the way for other applications.
Motivation & Objective
- Address the challenge of unsupervised anomaly detection and localization in industrial and medical imaging, where labeled anomalies are scarce.
- Overcome the limitations of standard autoencoders that generalize well and reconstruct anomalous regions, reducing detection performance.
- Integrate local and global context by combining convolutional feature extraction with block-wise self-attention to improve reconstruction fidelity and anomaly localization.
- Develop a unified model that performs both anomaly detection and pixel-wise segmentation without requiring patch-based inference.
- Improve generalization and robustness through a self-supervised learning strategy using artificial defect augmentation via Cut&Paste.
Proposed method
- Propose HaloAE, a hybrid architecture combining a pre-trained CNN feature extractor with a local 2D self-attention module based on HaloNet to model intra- and inter-patch dependencies.
- Use a multi-scale feature map generation strategy inspired by prior works to capture hierarchical and semantic-rich representations.
- Integrate a self-supervised proxy task using the Cut&Paste augmentation method to simulate defects and regularize the autoencoder.
- Design a multi-task loss function with adaptive weighting that combines classification loss (on augmented images), feature map reconstruction loss, and image reconstruction loss.
- Apply the local self-attention mechanism to compute attention within and across image blocks, reducing computational cost compared to global ViT-style attention.
- Train the model end-to-end using a combination of L2 and SSIM losses for reconstruction, with the final output used for both anomaly detection and segmentation via pixel-wise reconstruction error.
Experimental results
Research questions
- RQ1Can a local self-attention mechanism based on HaloNet improve anomaly detection and localization performance compared to standard convolutional autoencoders?
- RQ2Does integrating self-supervised learning through artificial defect augmentation enhance the generalization and robustness of autoencoders in anomaly detection?
- RQ3Can a single unified model effectively perform both image-level anomaly detection and pixel-wise localization without patch-based inference?
- RQ4How does adaptive loss weighting across multiple objectives (classification, feature map, and image reconstruction) affect model performance?
- RQ5To what extent does modeling intra-patch correlations via local attention improve reconstruction quality and anomaly localization accuracy?
Key findings
- HaloAE achieves a mean image-level ROC-AUC of 91.4% and a mean pixel-wise ROC-AUC of 91.2% on the MVTec dataset, demonstrating competitive performance.
- The model outperforms standard convolutional autoencoders (e.g., AE-L2: 70.0% image-level AUC) and even a vanilla HaloNet-based autoencoder (75.6% image-level AUC), showing the benefit of architectural integration.
- Replacing the HaloNet block with a convolutional autoencoder in the same architecture improves image-level AUC by 6.4 points (from 83.1 to 89.5), confirming the advantage of local self-attention.
- The adaptive loss weighting scheme (e.g., uncertainty weighting) achieves 97.2% image-level AUC on the text class, indicating effective multi-task learning.
- The use of self-supervised learning via Cut&Paste improves model generalization, as shown by higher scores on both detection and segmentation tasks.
- The ablation study confirms that the full HaloAE model with all components (feature extractor, local attention, SSL, and multi-loss) achieves the best performance, with the highest scores across all metrics.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.