Optimizing Vision Transformers for Medical Image Segmentation

Qianying Liu, Chaitanya Kaul, Jun Wang, Christos Anagnostopoulos, Roderick Murray-Smith, Fani Deligianni

Introduction

Medical Image Semantic Segmentation (MISS) is a critical component of modern digital medicine, involving the precise labeling of pixels in scans such as CT or MRI to identify specific organs or pathologies. Traditionally, Convolutional Neural Networks (CNNs), particularly the U-Net architecture, have been the standard due to their proficiency in capturing local textures and edges. However, CNNs often fail to model long-range dependencies—the "global context"—necessary for understanding complex spatial relationships between organs.

Vision Transformers (ViTs) were introduced to provide this global reasoning. Yet, standard ViTs face two major hurdles in medical imaging: a lack of fine-grained spatial context due to patch-based processing and a high "data hunger" caused by the absence of inductive biases like translation invariance. This paper introduces CS-Unet (Convolutional Swin-Unet), a hybrid architecture designed to be both compact and accurate by embedding convolutional layers directly into Transformer blocks.

Methodology: The CS-Unet Architecture

The core innovation of CS-Unet lies in re-introducing convolutional inductive biases to the Swin Transformer framework. This allows the model to learn effectively from smaller medical datasets without the need for massive pre-training on natural images (e.g., ImageNet).

Architecture of the (Shifted) Window-based convolutional multi-head self-attention (CST) and Depthwise Separable Feed-forward (DSF) module.

Key architectural components include:

  • Convolutional Swin Transformer (CST) Block: Unlike standard blocks that use linear projections for Query (Q), Key (K), and Value (V) matrices, the CST block employs depth-wise convolutions. This ensures the model maintains local spatial awareness even during global attention operations.
  • Depthwise Separable Feed-forward (DSF) Module: The traditional Multi-Layer Perceptron (MLP) in the Transformer's feed-forward network is replaced with depthwise separable convolutions to further enhance spatial modeling capabilities.
  • Convolutional Token Embedding: To preserve high-frequency spatial information, CS-Unet uses a four-stage convolutional embedding process instead of a single aggressive linear downsampling layer.
  • Skip Convolutions (SC): The standard U-Net skip connections are augmented with convolutional modules to better align and merge features between the encoder and decoder.

Experimental Results

The model was rigorously evaluated on two benchmarks: the Synapse Multi-organ Segmentation dataset (30 abdominal CT scans) and the Automatic Cardiac Diagnosis Challenge (ACDC) (100 cardiac MRI scans).

Quantitative Performance

CS-Unet achieved state-of-the-art (SOTA) results, notably reaching an 82.21% Dice score on the Synapse dataset. This significantly outperforms the standard pre-trained Swin-Unet (79.13%) and does so with a more efficient footprint. With only 24 million parameters, CS-Unet is lighter than Swin-Unet (27M) and substantially more efficient than heavy-weight models like TransUnet (96M) or nnFormer (158M).

Qualitative Analysis and Boundary Precision

A primary advantage of CS-Unet is its ability to delineate sharp organ boundaries, particularly for small or irregularly shaped organs like the pancreas and gallbladder.

Qualitative comparison of segmentation results on the Synapse dataset, showing CS-Unet's superior boundary precision compared to other variants.

As shown in the visual comparisons, standard Transformers often produce "rough" or over-segmented boundaries. By integrating local convolutional detail with global context, CS-Unet produces masks that more closely align with the Ground Truth (GT).

Discussion and Conclusion

The success of CS-Unet demonstrates that inductive bias is a powerful "shortcut" for medical imaging tasks where data is often scarce. By placing convolutions inside the attention mechanism, the model achieves the "best of both worlds": the local precision of CNNs and the global reach of Transformers.

While highly effective, the architecture's complexity—relying on the synergy of multiple specialized modules—may present challenges in hyperparameter tuning. Future work will focus on evaluating the model's generalization across other modalities, such as ultrasound and histopathology, and optimizing the computational overhead associated with the nested convolutional layers.

Summary updated

BibTeX
@inproceedings{liu2023optimizing,
  author = {Qianying Liu and Chaitanya Kaul and Jun Wang and Christos Anagnostopoulos and Roderick Murray-Smith and Fani Deligianni},
  title = {{Optimizing Vision Transformers for Medical Image Segmentation}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2023},
  doi = {10.1109/icassp49357.2023.10096379},
}
Figure