Introduction
Deep learning models have shown remarkable success in medical image segmentation, particularly for tasks like identifying brain hemorrhages in CT scans. However, a significant barrier to clinical deployment remains: the tendency of these models to produce "confidently wrong" predictions when presented with data outside their training distribution. In a clinical setting, a model might encounter motion artifacts, incorrect preprocessing, or even images of the wrong anatomy entirely. Standard uncertainty estimation methods often fail to flag these anomalies, potentially leading to dangerous clinical errors. This paper proposes a robust safety filter using a VQ-GAN and a Transformer to estimate the likelihood of 3D medical images, acting as a gatekeeper for safer AI-assisted diagnosis.
The Challenge of Out-of-Distribution Data
Most medical AI models are trained on curated, "clean" datasets. Clinical reality, however, is heterogeneous. Out-of-Distribution (OOD) data can range from "far-OOD" (e.g., a lung scan being fed into a brain-segmentation model) to "near-OOD" (e.g., a brain scan with unusual noise or different intensity scaling).
The core danger is that standard models—and even those utilizing uncertainty estimation techniques like Deep Ensembles or Monte Carlo Dropout—often assign high confidence to these anomalous inputs. For instance, a model trained on head CTs might look at a lung scan and confidently claim to see a brain bleed. There is a critical need for a system that can identify these anomalies before they reach the segmentation model.
Methodology: Generative Modeling for Likelihood Estimation
The authors introduce a two-stage generative approach to estimate the log-likelihood of 3D medical volumes.
1. VQ-GAN Compression
Processing 3D medical volumes directly with Transformers is computationally prohibitive due to high dimensionality. To address this, the authors employ a Vector Quantised Generative Adversarial Network (VQ-GAN). The VQ-GAN encoder compresses the 3D volume into a discrete latent space, effectively representing the image as a grid of "visual words" from a learned codebook. The decoder is trained to reconstruct the original image from these codes, ensuring the latent representation preserves essential structural information.
2. Sequence Modeling with the Performer
Once the 3D image is converted into a sequence of discrete codes, a Transformer is used to learn the probability distribution of these sequences. Specifically, the authors utilize the Performer architecture. The Performer uses a linear attention mechanism, which is essential for handling the long sequences generated by 3D data while remaining within memory constraints.
By calculating the log-likelihood of a new scan's code sequence, the system determines how closely the image matches the training distribution. If the likelihood is low, the image is flagged as OOD.
Experimental Evaluation
The models were trained using the CROMIS dataset, which contains 687 head CT scans with intracerebral hemorrhages (ICH). Testing was conducted across several scenarios:
- In-Distribution: 47 clinical head CT scans from the KCH dataset.
- Far-OOD: Images from the Medical Decathlon, featuring 10 different organs and modalities (e.g., heart MRI, lung CT).
- Near-OOD: The Corrupted KCH dataset, where 15 types of corruptions (e.g., Gaussian noise, axis flipping, skull-stripping, and global intensity scaling) were applied to the KCH scans.
Key Results and Insights
The proposed method demonstrated superior performance in identifying anomalous data compared to traditional uncertainty metrics.
Superior Detection Performance
The VQ-GAN + Transformer approach achieved a perfect AUC of 1.0 when distinguishing head CTs from far-OOD images (non-head scans). More impressively, it also achieved an AUC of 1.0 for several challenging near-OOD cases, such as skull-stripped images and global intensity scaling. In these same near-OOD scenarios, standard uncertainty methods performed poorly, with AUCs as low as 0.36.
Correlation with Segmentation Quality
A key finding was the strong correlation between the log-likelihood assigned by the Transformer and the actual performance of the segmentation model. Scans with low likelihood scores consistently resulted in a higher frequency of false-positive detections, confirming that likelihood is a reliable proxy for model reliability.
Spatial Interpretability
Beyond a global score, the method allows for the generation of spatial likelihood maps. By upsampling the conditional probabilities from the Transformer, the system can visualize exactly which regions of an image are considered anomalous. For example, if a scan is missing a portion of the skull, the spatial map highlights that specific area as low-likelihood, providing clinicians with interpretable evidence for why a scan was flagged.
Conclusion
This work represents the first successful application of Transformers for OOD detection in 3D medical imaging. By acting as a "gatekeeper," the VQ-GAN and Performer pipeline can effectively filter out scans that would otherwise lead to "confidently wrong" predictions. While future work is needed to validate the system against real-world clinical artifacts and to integrate it into live clinical workflows, this approach provides a significant step toward safer, more reliable medical AI.
Summary updated