DS-TransUNet: Dual Swin Transformer U-Net for Medical Image Segmentation

Ailiang Lin, Bingzhi Chen, Jiayu Xu, Zheng Zhang, Guangming Lu

TL;DR

DS-TransUNet is a medical image segmentation framework that integrates hierarchical Swin Transformers into both the encoder and decoder of a U-Net architecture. By employing a dual-scale encoder and a novel Transformer Interactive Fusion (TIF) module, it effectively captures both fine-grained details and global context, significantly outperforming existing CNN and Transformer-based methods across multiple clinical tasks.

What Problem Does This Paper Address?

Medical image segmentation—identifying structures like polyps, lesions, or cell nuclei—is a cornerstone of computer-aided diagnosis. For years, Convolutional Neural Networks (CNNs), particularly U-Net, have been the gold standard. However, CNNs have a fundamental flaw: their "receptive field" is limited by the size of the convolutional kernel. This makes it difficult for them to model long-range dependencies and global context (e.g., how a distant part of an organ relates to a potential lesion).

While Vision Transformers (ViTs) were introduced to solve this via self-attention, they bring their own challenges. Standard ViTs divide images into patches, often ignoring the fine-grained structural features inside those patches. Furthermore, most existing hybrid models only use Transformers in the encoder, leaving the decoder to rely on traditional convolutions that may lose the global context during up-sampling.

Methods

The authors propose DS-TransUNet, which introduces three major innovations to the standard U-shaped architecture:

  1. Dual-Scale Swin Transformer Encoder: Instead of a single input scale, the model uses two parallel branches. One branch processes the image with a small patch size (fine-grained) and the other with a larger patch size (coarse-grained). Both branches utilize Swin Transformer blocks, which use shifted windows to compute self-attention efficiently with linear computational complexity.
  2. Transformer Interactive Fusion (TIF) Module: Rather than simply concatenating features from the two scales, the TIF module (shown in Figure 3) uses a standard Transformer block to establish global dependencies between them. This ensures that the fine-grained features are informed by the coarse-grained global context.
  3. Swin Transformer Decoder: The authors extend the use of Transformers into the decoder. By placing Swin Transformer blocks after each up-sampling stage, the model maintains long-range contextual connections throughout the reconstruction of the segmentation mask.
Fig. 2: Illustration of the proposed Dual Swin Transformer U-Net (DS-TransUNet). Given an input medical image, we first split it into non-overlapping patches at two scales and feed them into the two branches of encoder separately, then the output feature representations of different scales will be fused by Transformer Inter-active Fusion (TIF) module. Finally, the fused features are restored to the same resolution as input image after the up-sampling process based on Swin Transformer block, hence obtaining the final mask predictions.

Datasets

The model was evaluated on four diverse medical imaging tasks:

  • Polyp Segmentation: Five public datasets (Kvasir, CVC-ClinicDB, CVC-ColonDB, EndoScene, and ETIS).
  • Skin Lesion Analysis: The ISIC 2018 dataset.
  • Gland Segmentation: The GLAS dataset.
  • Nuclei Segmentation: The 2018 Data Science Bowl dataset.

Key Insights and Ideas

  • Decoder Matters: A key "aha" moment is that Transformers shouldn't be restricted to the encoder. Introducing them into the decoder helps the model "remember" global spatial relationships while it is trying to pinpoint exact pixel boundaries.
  • Interactive vs. Passive Fusion: Simple concatenation is a "passive" way to combine multi-scale data. The TIF module (Figure 3) treats fusion as an "active" interaction, using self-attention to ensure semantic consistency between different scales.
  • Efficiency via Swin: By using Swin Transformer blocks (Figure 1b) instead of standard Transformer blocks (Figure 1a) in the main backbone, the model stays computationally feasible for high-resolution medical images.
Fig. 1: (a) The architecture of a standard Transformer block (notation presented with Eq. (1)); (b) The architecture of a Swin Transformer block (notation presented with Eq. (2) and Eq. (3)).

Key Results

DS-TransUNet consistently achieved state-of-the-art (SOTA) results:

  • Polyp Segmentation: On the Kvasir dataset, it achieved a mean Dice (mDice) score of 0.913, outperforming the previous SOTA, HarDNet-MSEG (0.904).
  • Skin Lesions: On ISIC 2018, it reached an F1 score of 0.9132, significantly higher than DoubleU-Net (0.8962).
  • Generalization: The model showed remarkable robustness on "unseen" datasets. For example, on the challenging ETIS polyp dataset, it outperformed the TransFuse model by a wide margin in mDice.
  • Qualitative Superiority: As seen in Figure 4 and Figure 5, DS-TransUNet produces much cleaner segmentation boundaries and is better at identifying "fuzzy" or low-contrast objects that standard U-Nets often miss.
Fig. 4: Qualitative results on polyp segmentation task of DS-TransUNet compared to other models. Our model shows better learning and generalization ability, which leads to higher-quality segmentation performance.

Limitations and Future Work

While highly effective, the dual-branch architecture is computationally demanding. The authors acknowledge that the "Large" version of their model (DS-TransUNet-L) is heavy, and they suggest that future work will focus on designing more lightweight Transformer-based models. Additionally, they aim to further refine how the model learns pixel-level intrinsic features that might still be slightly obscured by the initial patch division process.

Summary updated

BibTeX
@article{lin2022ds,
  author = {Ailiang Lin and Bingzhi Chen and Jiayu Xu and Zheng Zhang and Guangming Lu},
  title = {{DS-TransUNet: Dual Swin Transformer U-Net for Medical Image Segmentation}},
  journal = {IEEE Trans. Instrumentation \& Measurement},
  year = {2022},
  doi = {10.1109/tim.2022.3178991},
}
Figure