Introduction
Unsupervised Anomaly Detection (UAD) is a critical task in fields ranging from medical imaging to industrial quality control. Traditionally, Auto-encoders (AEs) are trained exclusively on normal data under the assumption that they will fail to reconstruct anomalies, thereby highlighting defects through high reconstruction error. However, deep neural networks often fall into a "generalization trap," where they become too proficient at reconstructing abnormal textures, making the difference between input and output nearly invisible.
The LSGS (Local-Sensitive Global-Sensitive) framework addresses this challenge by combining a Vector Quantized-Variational Autoencoder (VQVAE) with a novel aggregated codebook and a full-attention Transformer. This architecture allows the model to effectively "repair" abnormal image regions into their normal counterparts, setting new performance benchmarks on both medical and industrial datasets.
Methodology
The LSGS framework is built upon three primary innovations designed to balance local texture sensitivity with global structural awareness.
1. Local-Sensitive VQVAE with Aggregated Codebook
Standard VQVAEs often suffer from "codebook collapse," where only a small subset of embedding vectors is utilized. To ensure the discrete latent space perfectly represents the distribution of normal image patches, the authors extract all latent encodings from the training set and apply k-means clustering to create an "Aggregated Codebook." This forces the model to maintain a diverse and accurate "vocabulary" of normal textures, reducing reconstruction error for normal data.
2. Global-Sensitive Transformer
While many generative models use auto-regressive Transformers (like PixelCNN) that process data sequentially, LSGS utilizes a full-attention Transformer. In the context of spatial image data, full attention allows every patch to "see" every other patch simultaneously. This global perspective is essential for understanding structural relationships—for instance, the model needs to see the right side of a brain scan to determine if a patch on the left side is anatomically anomalous.
3. Self-Supervised Tampering Strategy
To train the Transformer to repair anomalies rather than just reconstruct them, the authors implement a "tampering" strategy. During training, 10% of the normal latent codes are randomly replaced with codes from the codebook. The Transformer is then tasked with reconstructing the original, untampered sequence. A specialized "abnormally focal loss" is used to prioritize the reconstruction of these corrupted patches, turning the model into a specialist in "normalizing" abnormal regions.
Experimental Results
The LSGS method was evaluated on two distinct domains: the BraTS2018 medical dataset (3D Brain MRIs) and the MVTec-AD industrial dataset.
Performance on BraTS2018
LSGS achieved significant improvements in medical anomaly detection, reaching an Average Precision (AP) of 75.7 and a Dice score of 68.7. This performance substantially outperformed previous state-of-the-art methods such as IS-cycle (AP 51.1) and f-AnoGAN (AP 37.3).
Performance on MVTec-AD
On the MVTec-AD industrial benchmark, the model achieved an average AUROC of 89.9. While it faced challenges with specific structured categories like "Zipper," it showed massive gains in complex categories such as "Transistor" (88.5 vs. 64.5 for DRAEM) and "Capsule" (95.1 vs. 50.5).
Ablation Study
The importance of the global repair step was confirmed through ablation testing. Removing the Transformer component caused the Dice score on the BraTS dataset to plummet from 0.687 to 0.295, proving that global context is the primary engine of the model's success.
Discussion and Future Work
LSGS demonstrates that the combination of local texture sensitivity and global structural understanding is a powerful solution to the generalization trap. However, some limitations remain:
- Heuristics: The 10% tampering rate is a hyperparameter that may need tuning for different domains.
- Complexity: Full-attention Transformers scale quadratically with sequence length, which may necessitate more efficient attention mechanisms for higher-resolution images.
- Geometric Constraints: The model's slightly lower performance on highly rigid geometric objects (like screws or tiles) suggests that incorporating explicit geometric priors could be a fruitful area for future research.
In conclusion, by shifting the focus from simple reconstruction to active repair, LSGS provides a robust framework for unsupervised defect detection across diverse applications.
Summary updated