TransUNet: Transformers Make Strong Encoders for Medical Image Segmentation
- Publication
- Publication venue not yet verified
- First submitted to arXiv
- arXiv:2102.04306
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{featurefusiontransunet2021,
title = {{TransUNet: Transformers Make Strong Encoders for Medical Image Segmentation}},
author = {Jieneng Chen and Yongyi Lu and Qihang Yu and Xiangde Luo and Ehsan Adeli and Yan Wang and Le Lu and Alan L. Yuille and Yuyin Zhou},
year = {2021},
eprint = {2102.04306},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2102.04306}
}
ViT was proposed at the end of 2020, and its applications quickly expanded across many fields.
Here, we examine a paper that combines U-Net and ViT. The paper itself isn't difficult; as long as you're familiar with the concepts of U-Net and ViT, you'll be able to grasp it easily.
Defining the Problem
Introducing attention into CNNs is nothing new, but its use in medical image segmentation was still relatively uncommon.
Little prior work on this combination? That's the problem to tackle!
The authors wanted to use a "sequence-to-sequence" approach, much like ViT, by splitting images into many patches and feeding them directly into a Transformer, learning the global features of the image in the process.
However, if we simply use upsampling to resize the low-resolution features produced by the Transformer to the original size (e.g., using Upsample), we would only get coarse segmentation results. While Transformer excels at processing global information, it doesn't inherently enhance local boundaries and details.
ViT commonly uses 16×16 image patches. Smaller patches preserve a denser spatial grid, but segmentation does not inherently require 8×8 or 4×4 patches. At a fixed image size, halving the patch side length gives four times as many tokens and roughly sixteen times as many pairwise interactions in full self-attention. A decoder with high-resolution skip connections offers another way to recover detail.
So, we need to first address the issues of "multi-scale downsampling" and "resolution."
Solving the Problem
ViT with simple upsampling can produce segmentation results, but the experiments leave room for improvement. The authors therefore propose this hybrid architecture:
First, CNN is used for feature extraction, like a typical Backbone, which generates feature maps at 1/2, 1/4, 1/8, and 1/16 resolutions.
Given the computational complexity of Transformer, only the 1/16 resolution feature maps are used, paired with a patch size, converting the CNN feature map into a sequence (not splitting the raw image into 1×1-pixel patches), which is then passed through a Transformer for global feature extraction.
After the Transformer performs self-attention operations, it produces a more "global" feature representation, which is then transformed back into a 1/16 resolution feature map. The CNN's progressive upsampling (like U-Net's decoder) is used to fuse feature maps at other resolutions. In this way, we retain the advantages of global information while using skip connections to supplement local details, resulting in finer segmentation.
Discussion
- The table above shows the use of Cascaded Upsampler (CUP) to compare the performance of direct upsampling.
On the Synapse abdominal CT multi-organ dataset, the authors compare mean DSC across eight organs (higher is better) and Hausdorff distance, or HD (lower is better), against V-Net, DARR, U-Net and AttnUNet. Both the ViT and ResNet-50 backbones use ImageNet pretraining; the U-Net and AttnUNet rows also use a pretrained ResNet-50 encoder.
Additionally, to validate the effectiveness of CUP and Hybrid Encoder, the experiments compared the following variants:
- ViT-None: ViT as the encoder, using simple upsampling for decoding
- ViT-CUP: ViT as the encoder, paired with CUP decoder
- R50-ViT-CUP: ResNet-50 + ViT as the encoder, paired with CUP decoder
- TransUNet: R50-ViT-CUP + U-Net style skip connections
These variants separate the roles of the decoder, hybrid encoder and skip connections. Each comparison must still be read in its own setting.
- Direct Upsampling vs. CUP: Comparing ViT-None vs. ViT-CUP, mean DSC rose from 61.50% to 67.86%, a gain of 6.36 percentage points; HD fell from 39.61 mm to 36.11 mm, a drop of 3.50 mm. This supports CUP over simple upsampling in this experiment and is consistent with finer boundary recovery.
- ViT vs. R50-ViT: Keeping CUP, mean DSC rose from 67.86% with ViT-CUP to 71.29% with R50-ViT-CUP, another 3.43 points; HD fell from 36.11 mm to 32.87 mm, or 3.24 mm. This supports using CNN features alongside ViT, without proving that every individual boundary is better.
Finally, TransUNet reaches 77.48% mean DSC and 31.69 mm HD. Its mean DSC is 1.91–8.67 points higher than the four earlier methods; it exceeds the best of those CNN methods, R50-AttnUNet (75.57%), by 1.91 points. Against R50-ViT-CUP without U-Net-style skips (71.29%), it gains 6.19 points.
The authors attribute the gain to complementary global relationships and local detail. Stacked CNN layers can enlarge the receptive field, but standard convolutions do not directly connect every pair of tokens as global self-attention does. Low-resolution ViT outputs need an appropriate decoder to recover detail. TransUNet has the highest mean DSC in this table, not the best result for every organ or a universal advantage across medical segmentation tasks.
Conclusion
TransUNet combines a Transformer's global self-attention with the low-level detail represented by CNN features. In the Synapse experiment, this U-shaped hybrid architecture produced better segmentation than the CNN-based attention methods listed in the paper's comparison.
It offers a new way to combine global and local information for medical image segmentation, showing the potential of Transformers in this setting.