More than Encoder: Introducing Transformer Decoder to Upsample

Yijiang Li, Wentian Cai, Ying Gao, Chengming Li, Xiping Hu

In the world of medical image segmentation, the "U-Net" architecture is king. It works by squeezing an image down to capture its meaning (encoding) and then blowing it back up to create a pixel-perfect map (decoding). However, the "blowing up" part—upsampling—has long been a weak link. This paper introduces a clever way to fix it using the power of Transformer decoders.

TL;DR

The authors propose Window Attention Upsample (WAU), a novel module that replaces traditional "blind" upsampling with a Transformer decoder. By conditioning the upsampling process on high-resolution features from the encoder, WAU achieves state-of-the-art accuracy in segmenting tumors and organs with significantly fewer parameters than previous Transformer-based models.

What Problem Does This Paper Address?

Standard upsampling techniques like bilinear interpolation or transposed convolutions are relatively simple. They try to "guess" the missing pixels based on a low-resolution map, often ignoring the rich, detailed information (like sharp boundaries and fine tissue textures) that was captured earlier in the encoding process.

In medical imaging, these details are life-and-death. A blurry boundary can mean the difference between segmenting a healthy organ and a malignant tumor. While recent "Transformer-based" models have tried to improve things, they mostly focus on the encoder side. This paper argues that the decoder—specifically how we upsample—is where the real magic should happen.

Methods

The core innovation is the Window Attention Upsample (WAU) module. It consists of two main parts:

  1. Window Attention Decoder (WAD): Instead of just resizing a feature map, the authors use a Transformer decoder. In this setup, the high-resolution features from the encoder act as the Query, while the low-resolution features from the previous decoder layer act as the Key and Value. This allows the model to "look back" at the encoder to find the exact details needed for reconstruction.
  2. Locality Constraints: To keep the model efficient and focused, they use Window Attention (restricting the "search" to local neighborhoods) and Convolutional Projections (using 3x3 convolutions instead of linear layers to generate the attention matrices).
  3. Residual Connection: They add a standard bilinear upsampling path as a residual connection to the WAD output. This ensures the model has a solid baseline to build upon and makes training more stable.
The WAU architecture combines a Window Attention Decoder with a standard bilinear path.

Datasets

The researchers evaluated WAU on three major medical imaging benchmarks:

  • MSD Task01 BrainTumour (MSD Brain): 484 multi-modal MRI scans for segmenting different regions of brain tumors.
  • Synapse Multi-organ Segmentation: 30 abdominal CT cases used to identify 8 different organs.
  • Automatic Cardiac Diagnosis Challenge (ACDC): 100 MRI scans focused on segmenting heart structures like the left and right ventricles.

Key Insights and Ideas

  • The Decoder as a Natural Upsampler: The authors realized that a Transformer decoder is inherently an upsampler if the Query sequence is longer than the Key/Value sequence. This is a beautiful, "hidden in plain sight" property of Transformers.
  • Less is More (Attention): Surprisingly, global attention (looking at the whole image at once) can actually hurt upsampling. The model can get "distracted" by irrelevant distant pixels. Restricting attention to local windows (WAD) not only saves memory but actually improves accuracy by forcing the model to focus on local textures.
  • Plug-and-Play: WAU isn't a whole new model; it's a module. The authors successfully dropped it into classic architectures like ResUNet, FCN, and DeepLabV3, seeing consistent improvements across the board.

Key Results

WAU set new state-of-the-art (SOTA) benchmarks across all tested datasets:

  • Synapse: Achieved a 80.40% Dice Similarity Coefficient (DSC), significantly outperforming the popular TransUNet (77.48%) and SwinUNet (79.13%).
  • Efficiency: The ResUNet+WAU model uses only 21.8M parameters. For comparison, TransUNet uses a massive 93.2M parameters to achieve lower accuracy.
  • Visual Clarity: Qualitative results show that WAU produces much sharper, more complete segmentations. As seen in Figure 1, the feature maps generated by WAU (bottom) are significantly more detailed and focused on the target anatomy than the baseline ResUNet (top).
Visualization of feature maps showing WAU's superior detail restoration.

Limitations and Future Work

  • Hyperparameter Tuning: The optimal window size for the attention mechanism varies by dataset (e.g., size 4 for Brain vs. size 7 for Synapse). Automating this selection could be a valuable future improvement.
  • Inductive Bias: The success of convolutional projections suggests that pure Transformers still benefit from the "locality bias" of CNNs in medical tasks. Exploring the theoretical limits of this hybrid approach remains an open question.
  • 3D Extension: While tested on 3D datasets (like MSD Brain), the implementation details for full 3D volumetric attention could be further optimized for even higher-dimensional data.

Summary updated

BibTeX
@inproceedings{li2022more,
  author = {Yijiang Li and Wentian Cai and Ying Gao and Chengming Li and Xiping Hu},
  title = {{More than Encoder: Introducing Transformer Decoder to Upsample}},
  booktitle = {BIBM},
  year = {2022},
  doi = {10.1109/bibm55620.2022.9995378},
}
Figure