Abstract
Medical image segmentation requires capturing both local details and global context. While Convolutional Neural Networks (CNNs) excel at the former, they struggle with long-range dependencies. Conversely, standard Vision Transformers (ViTs) capture global context but suffer from quadratic computational complexity. We present CSWin-UNet, a pure Transformer-based U-shaped architecture that utilizes cross-shaped window self-attention and content-aware upsampling (CARAFE). CSWin-UNet achieves state-of-the-art performance on multiple benchmarks, including Synapse and ACDC, while significantly reducing computational overhead compared to previous Transformer models.
Introduction
Accurate segmentation of anatomical structures is critical for medical diagnosis and treatment planning. The UNet architecture, based on CNNs, has long been the standard due to its effective multi-scale feature fusion. However, the inherent local receptive field of convolutions limits their ability to model global spatial relationships.
Vision Transformers have emerged as a powerful alternative, using self-attention to model long-range dependencies. Yet, the high computational cost of global self-attention has led to the development of window-based approaches like Swin-UNet. While efficient, small square windows restrict the interaction between distant regions. CSWin-UNet addresses this by introducing a cross-shaped window mechanism that broadens the receptive field without the quadratic cost.
Methodology
CSWin Self-Attention
The core innovation of CSWin-UNet is the Cross-Shaped Window (CSWin) self-attention. Unlike the square windows in Swin-UNet, CSWin splits attention heads into horizontal and vertical stripes. This configuration allows each token to attend to others across the full width and height of the feature map in a single operation.
By varying the stripe width across different stages of the encoder, the model balances local feature extraction with global context acquisition. This "pseudo-global" receptive field is particularly effective for identifying organs with complex shapes or indistinct boundaries.
Content-Aware Upsampling (CARAFE)
In the decoder, traditional upsampling methods like bilinear interpolation or transposed convolutions often fail to preserve sharp edges. CSWin-UNet integrates CARAFE (Content-Aware ReAssembly of FEatures), which dynamically predicts upsampling kernels based on local feature content. This ensures more precise boundary reconstruction, a vital requirement for medical imaging.
Architectural Details
The model also incorporates Locally-enhanced Positional Encoding (LePE) to better handle spatial information and maintains the classic UNet skip connections to bridge the gap between low-level spatial details and high-level semantic features.
Experiments and Results
Datasets
The model was evaluated on three major benchmarks:
- Synapse Multi-organ CT: 30 abdominal CT scans for segmenting eight organs.
- ACDC (Automated Cardiac Diagnosis Challenge): 100 cardiac MRI datasets.
- Skin Lesion Datasets: ISIC2017, ISIC2018, and PH2 dermoscopic images.
Performance and Efficiency
CSWin-UNet consistently outperformed state-of-the-art models. On the Synapse CT dataset, it achieved a Dice Similarity Coefficient (DSC) of 81.12%, a 2% improvement over Swin-UNet. Notably, it showed superior performance on the pancreas, an organ typically difficult to segment due to its small size and low contrast.
Furthermore, CSWin-UNet is highly efficient. It requires only 23.57M parameters and 4.72G FLOPs, compared to TransUNet’s 96.07M parameters and 88.91G FLOPs, representing a roughly 75% reduction in parameter count while delivering better accuracy.
Conclusion
CSWin-UNet demonstrates that cross-shaped window attention combined with content-aware upsampling provides a powerful and efficient framework for medical image segmentation. By bridging the gap between local precision and global context, it sets a new standard for Transformer-based medical imaging architectures. Future work will focus on improving performance in low-contrast scenarios and reducing the dependency on ImageNet pre-training.
Summary updated