TL;DR
Vision Transformers (ViTs) are revolutionizing computer vision, but their ability to detect "out-of-distribution" (OOD) data – inputs that differ significantly from training data – is crucial for safety-critical applications like medical diagnosis. This paper finds that current ViTs struggle with OOD detection on medical image datasets, performing only comparably to older CNN architectures, highlighting a significant gap for future research.
What Problem Does This Paper Address?
Modern deep learning models, especially in fields like medical imaging, are often trained on data that represents a specific, "in-distribution" (ID) set of conditions. However, real-world scenarios are messy, and models will inevitably encounter data that deviates from this training distribution – this is known as "out-of-distribution" (OOD) data. For safety-critical applications, it's vital that a model can not only perform its task but also recognize when it's encountering something it wasn't trained for, rather than confidently making a wrong prediction. This paper investigates how well the newer, powerful Vision Transformers (ViTs) can perform this OOD detection task, particularly in the context of medical images, where misdiagnosis can have severe consequences.
Methods
The researchers pre-trained four different Vision Transformer models: the original Vision Transformer (ViT) and three variants of the Data-efficient Image Transformer (DeiT) – original, soft distillation, and hard distillation. These models were trained using standard cross-entropy loss on in-distribution data. For OOD detection, the pre-trained models were then evaluated on their ability to distinguish between in-distribution samples and out-of-distribution samples. The core idea is to see if the model's confidence (specifically, the maximum predicted softmax probability) is lower for OOD samples compared to ID samples. They also included ResNet34 and ResNet152 as baseline CNN models for comparison.
Datasets
The study utilized two publicly available medical image datasets:
- HAM10000: This dataset contains 25,332 skin lesion images from 8 different classes. For their experiments, the authors designated the "Melanoma" class as OOD due to its severity and rarity, while the remaining 7 classes were treated as in-distribution.
- DermNet: This dataset comprises 22,494 skin lesion images from 23 classes. Here, 4 classes with fewer than 500 images each were designated as OOD, and the remaining 19 classes were used as in-distribution.
A standard 90%-10% split was used for training and testing the in-distribution data, with the testing set serving as the in-distribution data for OOD evaluation.
Key Insights and Ideas
- ViTs Aren't Magic Bullets for OOD: Despite their impressive performance on standard image recognition tasks, ViTs don't inherently offer superior OOD detection capabilities compared to well-established CNNs. This suggests that architectural advancements alone don't solve the OOD problem.
- Medical Images Present Unique Challenges: The paper posits that the features distinguishing medical images (like skin lesions) might be subtle and low-level (e.g., biological features, contours). ViTs, with their patch-based processing, might inadvertently lose some of this fine-grained information during flattening, potentially hindering their OOD detection performance.
- The Need for Dedicated OOD Research: The findings strongly advocate for increased research focus on improving OOD detection specifically for transformer architectures, especially in safety-critical domains.
Key Results
The paper's results, summarized in Table 1, indicate that the evaluated Vision Transformers (ViT, DeiTorig, DeiTsoft, DeiThard) generally exhibit inadequate performance in OOD detection on both HAM10000 and DermNet datasets.
- AUROC scores for the transformers ranged from approximately 53% to 58% on HAM10000 and 53% to 54% on DermNet.
- These scores were comparable to, or even slightly lower than, the ResNet34 baseline (around 59.5% on HAM10000 and 53.5% on DermNet).
- The ResNet152 model performed the best among all tested architectures, achieving AUROC scores of 61.87% on HAM10000 and 55.73% on DermNet, suggesting that deeper CNNs still hold an advantage in this specific OOD detection scenario.
- Other metrics like AUPR (Area Under the Precision-Recall curve) and FPR95 (False Positive Rate at 95% True Positive Rate) also showed similar trends, with transformers not outperforming the CNN baselines.
Limitations and Future Work
The authors explicitly state that the OOD detection performance of the evaluated transformers is insufficient for deployment in safety-critical applications. They encourage future research in this area.
Potential future directions, implied by the paper's findings, include:
- Developing new transformer architectures or training strategies specifically designed to enhance OOD detection capabilities.
- Investigating methods to better preserve low-level feature information within transformers, which might be crucial for distinguishing subtle differences in medical images.
- Exploring alternative OOD detection techniques beyond relying solely on softmax confidence.
- Evaluating a wider range of transformer models and medical imaging tasks.
Summary updated