TL;DR
VIViT (Variable-Input Vision Transformer) is a novel framework designed for 3D medical image segmentation that natively handles varying sets of MRI contrasts during both self-supervised pretraining and downstream finetuning. By treating different imaging modalities as flexible token sequences, VIViT eliminates the need for rigid, fixed-input architectures, allowing researchers to maximize the use of heterogeneous, real-world clinical datasets.
What Problem Does This Paper Address?
In routine clinical practice, a full Magnetic Resonance Imaging (MRI) study rarely looks the same from patient to patient. Depending on the hospital's protocol or the specific diagnostic goal, a study might include a different mix of image contrasts (such as T1, T2, FLAIR, or ADC).
This real-world heterogeneity poses a major challenge for deep learning models. Standard Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) typically require a fixed, predefined set of input modalities. If a contrast is missing, researchers often resort to zero-filling, which degrades performance. Conversely, if a new contrast is introduced, the model architecture must be redesigned and retrained from scratch. While some "missing modality" methods exist, they usually require knowing the full superset of modalities during training and cannot gracefully handle entirely unseen contrasts.
VIViT addresses this gap by creating a unified framework capable of learning from variable input contrast sets during both large-scale self-supervised pretraining and downstream task finetuning.
Methods
The VIViT framework consists of two main phases: self-supervised pretraining using a masked autoencoder (MAE) strategy, followed by downstream segmentation finetuning.
To handle variable inputs seamlessly, the authors introduced three key architectural components:
- Dynamic Patch Tokenizer: Standard tokenizers expect fixed inputs. VIViT uses dynamic convolution layers that adjust their kernel weights on the fly based on a specific "modality vector." It extracts features in two stages—first using a large kernel ($7\times7\times7$) for low-level features, and then projecting them into 1D tokens matching the transformer's embedding dimension.
- Dynamic Transformer-Convolution Encoder: Transformers are inherently suited for variable-length sequences. VIViT exploits this by concatenating all available tokens from all present modalities into one long sequence. The encoder alternates between standard Transformer blocks (for global, cross-modality attention) and dynamic 3D convolution layers (to preserve and reinforce local spatial relationships).
- Modality Fusion Decoder: For downstream segmentation, the long token sequence is split back into modality-specific short sequences. A two-step decoding process applies modality-specific self-attention to each sequence, averages the decoded tokens across all present modalities, and then passes the aggregated 4D feature maps into a multi-level CNN decoder to output the final segmentation mask.
Datasets
The authors evaluated VIViT across three distinct datasets:
- Self-supervised Pretraining: A massive internal dataset containing 45,374 MRI studies. Each study possessed a highly variable number of contrasts drawn from a pool of eight possible types (ADC, TraceW, T2, GRE, SWI, T1, T1CE, and FLAIR).
- Brain Infarct Segmentation: A dataset consisting of 1,648 training, 193 validation, and 215 test studies. TraceW and ADC images were always present, while T2 was optional.
- Brain Tumor Segmentation: The benchmark BraTS 2021 dataset (1,001 train, 100 validation, 150 test studies), which features four fixed contrasts: FLAIR, T1, T1CE, and T2.
Key Insights and Ideas
- Embracing the Messiness of Clinical Data: Instead of filtering out incomplete patient studies to create a pristine dataset, VIViT turns data variability into an advantage. By allowing the model to ingest whatever contrasts are available, it unlocks massive, previously unusable clinical archives for self-supervised pretraining.
- Transformers as Multi-Modality Aggregators: By treating different imaging modalities simply as additional tokens in a sequence, the transformer naturally bypasses the rigid structural constraints of traditional CNNs.
- The Power of "Partial" Pretraining: A particularly striking finding was that even if certain modalities (like T1 and T2) are completely omitted during the pretraining phase, the model can still transfer foundational knowledge from the remaining modalities and quickly "pick up" the relationships of the new contrasts during downstream finetuning.
Key Results
VIViT outperformed several state-of-the-art architectures, including UNet, UNETR, SwinUNETR, and AdaptiveUNETR, on both segmentation tasks.
- Brain Infarct Segmentation: VIViT combined with self-supervised learning (VIViT+SSL) achieved a top mean Dice score of 0.624, outperforming the closest variable-input competitor, AdaptiveUNETR+SSL (0.598).
- Brain Tumor Segmentation: VIViT+SSL achieved a mean Dice score of 0.883, demonstrating strong performance even on datasets where all modalities are fully present.
- Ablation Studies: Progressive integration of the components showed clear benefits: the baseline modality fusion decoder scored 0.595, adding the Dynamic Patch Tokenizer raised it to 0.611, and adding the Dynamic Encoder brought it to the peak of 0.624. The optimal pretraining masking ratio was determined to be 70%.
Limitations and Future Work
While VIViT handles missing and unseen modalities remarkably well, the authors note that the benefits of pretraining are still maximized when the pretraining dataset fully covers the downstream task's input contrasts.
For future work, the authors suggest exploring a mix of supervised and self-supervised pretraining strategies within this framework and extending VIViT's application to other heterogeneous medical imaging domains beyond brain MRIs.
Summary updated