[Paper Review] Transformer-based out-of-distribution detection for clinically safe segmentation
This paper proposes a 3D transformer-based out-of-distribution (OOD) detection method for clinical image segmentation using a VQ-GAN to compress head CT scans and a transformer to estimate data likelihood. It successfully identifies both far- and near-OOD scans, with image likelihood strongly correlating to segmentation performance, enabling reliable filtering of problematic inputs before segmentation.
In a clinical setting it is essential that deployed image processing systems are robust to the full range of inputs they might encounter and, in particular, do not make confidently wrong predictions. The most popular approach to safe processing is to train networks that can provide a measure of their uncertainty, but these tend to fail for inputs that are far outside the training data distribution. Recently, generative modelling approaches have been proposed as an alternative; these can quantify the likelihood of a data sample explicitly, filtering out any out-of-distribution (OOD) samples before further processing is performed. In this work, we focus on image segmentation and evaluate several approaches to network uncertainty in the far-OOD and near-OOD cases for the task of segmenting haemorrhages in head CTs. We find all of these approaches are unsuitable for safe segmentation as they provide confidently wrong predictions when operating OOD. We propose performing full 3D OOD detection using a VQ-GAN to provide a compressed latent representation of the image and a transformer to estimate the data likelihood. Our approach successfully identifies images in both the far- and near-OOD cases. We find a strong relationship between image likelihood and the quality of a model's segmentation, making this approach viable for filtering images unsuitable for segmentation. To our knowledge, this is the first time transformers have been applied to perform OOD detection on 3D image data. Code is available at github.com/marksgraham/transformer-ood.
Motivation & Objective
- To address the clinical risk of deep learning models making confidently wrong predictions on out-of-distribution (OOD) medical images.
- To evaluate existing uncertainty estimation methods (e.g., dropout, ensembles) in far- and near-OOD scenarios for 3D CT segmentation.
- To develop a robust OOD detection system that filters out data likely to cause segmentation failure before processing.
- To investigate whether image likelihood estimated via a transformer on VQ-GAN latents correlates with segmentation network performance.
- To validate the approach on diverse OOD data including non-head CTs, MRIs, and corrupted scans.
Proposed method
- Use a VQ-GAN to compress 3D head CT volumes into a discrete latent space, reducing dimensionality for efficient modeling.
- Train a transformer to model the autoregressive sequence of latent tokens, enabling exact likelihood estimation of input images.
- Compute the log-likelihood of each input volume as a measure of distributional conformity.
- Use the likelihood score as a proxy for OOD risk, with low likelihood indicating potential data distribution shift.
- Integrate the likelihood thresholding as a pre-filter before feeding images to a downstream segmentation network.
- Train and evaluate segmentation networks with Monte Carlo dropout to assess performance correlation with likelihood scores.
Experimental results
Research questions
- RQ1Do standard uncertainty estimation methods (e.g., dropout, ensembles) fail when applied to far- and near-OOD medical images in 3D segmentation?
- RQ2Can a transformer-based likelihood estimator on VQ-GAN latents effectively detect both far- and near-OOD 3D medical images?
- RQ3Is there a strong correlation between image likelihood and the segmentation network's performance (e.g., false positive rate)?
- RQ4Does the proposed OOD detection method prevent segmentation networks from making confidently wrong predictions on anomalous inputs?
- RQ5How does the inclusion of perceptual and adversarial losses in the VQ-GAN affect OOD detection performance?
Key findings
- All standard uncertainty estimation methods (e.g., dropout, ensembles) failed on OOD data, producing confidently wrong predictions in both far- and near-OOD cases.
- The proposed VQ-GAN + transformer approach achieved 100% AUC in distinguishing in-distribution head CTs from 10 different OOD classes, including non-head CTs, MRIs, and corrupted scans.
- Image log-likelihood strongly correlated with segmentation network performance: inputs with likelihood < -7000 had significantly higher false positive rates.
- Corrupted scans with likelihoods close to in-distribution data (e.g., noise σ=0.01, AUC=0.49) were handled better by segmentation networks, indicating subtle corruptions.
- The method avoided the common failure mode of assigning high likelihoods to highly OOD samples, suggesting improved robustness over prior generative OOD detection.
- Spatial likelihood maps localized corruption sources (e.g., skull stripping, noise), enabling explainable detection of problematic image regions.
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.