Abstract
Transformer architecture has emerged to be successful in a number of natural language processing tasks. However, its applications to medical vision remain largely unexplored. In this study, we present UTNet, a simple yet powerful hybrid Transformer architecture that integrates self-attention into a convolutional neural network for enhancing medical image segmentation. UTNet applies self-attention modules in both encoder and decoder for capturing long-range dependency at different scales with minimal overhead. To this end, we propose an efficient self-attention mechanism along with relative position encoding that reduces the complexity of self-attention operation significantly from $O(n^2)$ to approximate $O(n)$. A new self-attention decoder is also proposed to recover fine-grained details from the skipped connections in the encoder. Our approach addresses the dilemma that Transformer requires huge amounts of data to learn vision inductive bias. Our hybrid layer design allows the initialization of Transformer into convolutional networks without a need of pre-training. We have evaluated UTNet on the multi-label, multi-vendor cardiac magnetic resonance imaging cohort. UTNet demonstrates superior segmentation performance and robustness against the state-of-the-art approaches, holding the promise to generalize well on other medical image segmentations.
Introduction
Medical image segmentation is a cornerstone of digital health, traditionally dominated by Convolutional Neural Networks (CNNs) like the U-Net. While CNNs excel at local feature extraction, they struggle with "long-range dependencies" due to their limited receptive fields. Understanding how distant pixels relate to one another typically requires deep stacking and downsampling, which often sacrifices fine-grained anatomical detail.
Transformers offer a solution by allowing every part of an input to attend to every other part. However, they introduce two major challenges in medical imaging: quadratic computational complexity ($O(n^2)$) and a lack of "inductive bias," which usually necessitates massive pre-training datasets. UTNet addresses these hurdles through a hybrid design and an efficient attention mechanism.
The UTNet Architecture
UTNet integrates Transformer modules into a standard U-shaped encoder-decoder structure. Instead of replacing CNNs, it uses them to extract local features and provide the necessary inductive bias, allowing the model to be trained from scratch on relatively small medical datasets.
Key architectural innovations include:
- Efficient Self-Attention: By sub-sampling the Key ($K$) and Value ($V$) matrices into a lower-dimensional space, the authors reduce sequence length and drop computational complexity to approximate $O(n)$. This allows self-attention to be applied even to high-resolution feature maps.
- Relative Position Encoding: To overcome the "permutation invariance" of standard Transformers, UTNet incorporates 2D relative position information, ensuring the model maintains the spatial awareness critical for anatomical accuracy.
- Transformer Decoder: A specialized decoder module uses attention to recover fine details from the encoder's skip connections, bridging the gap between high-level semantics and low-level spatial features.
Experimental Evaluation
The model was evaluated on a multi-label, multi-vendor cardiac MRI cohort. The training set consisted of 150 annotated images from Siemens and Philips vendors. To test generalization, the model was evaluated on 200 images, including 100 from "unseen" vendors (GE and Canon). The task involved segmenting the Left Ventricle (LV), Right Ventricle (RV), and Myocardium (MYO).
Key Results
UTNet consistently outperformed standard U-Net, ResUNet, and other attention-augmented models across all metrics. It achieved an average Dice score of 88.3%, a significant improvement over the 86.4% baseline of the standard U-Net.
Beyond accuracy, the model demonstrated remarkable efficiency and robustness:
- Efficiency: The linear complexity mechanism is a game-changer; in comparative tests, UTNet required only 3.8 GB of GPU memory, whereas a standard "Dual Attention" model required 36.9 GB. Inference time remained competitive at 0.145s.
- Robustness to Domain Shift: UTNet proved highly robust to the "domain shift" caused by different MRI hardware. By capturing global shapes rather than just local textures, it maintained high performance on unseen vendors where pure CNN approaches often struggled with noise and motion artifacts.
- Resolution Sensitivity: Ablation studies revealed a "Goldilocks" effect: adding Transformers to the shallowest layers (highest resolution) provided little benefit, as these layers focus on tiny textures. UTNet is most effective when attention is focused on middle and deep layers.
Conclusion
UTNet successfully bridges the gap between the local feature extraction of CNNs and the global dependency modeling of Transformers. By reducing self-attention complexity to linear time and incorporating relative position encoding, it provides a powerful, data-efficient tool for medical image segmentation. Future work may extend this architecture to 3D volumes or other clinical tasks such as lesion detection and image reconstruction.
Summary updated