HiFormer
Medical image segmentation network that fuses CNN and Swin Transformer features through cross-attention.
Medical imaging · 859 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Medical imaging
- Parameters
- 25.5M
- Operations
- 859
- Framework
- PyTorch
- Recurrent
- No
- Published
- WACV 2023
- Paper
- HiFormer: Hierarchical Multi-scale Representations Using Transformers for Medical Image Segmentation
- Cited by
- 575 (as of 28 October 2026)
- Authors
- Moein Heidari, Amirhossein Kazerouni, Milad Soltany and others
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m17336
- Graph hash
- 0230ea82992fc321ca0b02df6e89d0d2555ecddad8cee19f311cee7b4c5d2002
- Skeleton hash
- e7a1a6ae6f2cae25b51cf27c02e0f54ba546a725ae2e5707e7790eee66b860a0
- Architecture hash
- a5fdadf55adfec9689d328d7b79653e3aee3a82427470cdf870734bce64f413b
- Diagram SHA-256
- 0e98c11d4e6b53215104da3f5f823467ba2cf92951c4a14ffaf024f82d9fafb5
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
HiFormer is a method that bridges a CNN and a transformer for medical image segmentation. Its paper starts from two limits: CNNs struggle to model long-range dependencies, and transformers fail to capture low-level features.
The encoder is composed of two hierarchical models, a CNN and a Swin Transformer, each with three levels. Local features from each CNN level are transferred to the corresponding Swin Transformer level through a skip connection. A Double-Level Fusion (DLF) module then takes the smallest and largest levels as inputs and uses a cross-attention mechanism to fuse information across scales. The middle level is left out of the fusion to save computational cost. Because only the class token is used as the query, the cross-attention operates in linear time. The decoder, motivated by Semantic FPN, combines the two levels into a unified mask feature, and a segmentation head generates the final segmentation map.
The paper uses an input image size of 224 × 224 and initializes the CNN and Swin Transformer modules with weights pre-trained on ImageNet. An ablation over CNN backbones led the authors to use ResNet50 as the default. The repository offers three configurations, hiformer-s, hiformer-b and hiformer-l. On Synapse multi-organ segmentation, the paper reports that HiFormer-B raises the Dice score by 2.91% and 1.26% compared to TransUnet and Swin-Unet, respectively.
Key idea. HiFormer fuses multi-scale features from a CNN and a Swin Transformer with a Double-Level Fusion module placed in the skip connection of an encoder-decoder structure.
- HiFormer
- Double-Level Fusion
- DLF module
- medical image segmentation
- CNN-transformer hybrid
- multi-organ segmentation
- Synapse dataset
- skin lesion segmentation
- hierarchical multi-scale representations
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{heidari2023hiformerhierarchicalmultiscalerepresentations,
title={HiFormer: Hierarchical Multi-scale Representations Using Transformers for Medical Image Segmentation},
author={Moein Heidari and Amirhossein Kazerouni and Milad Soltany and Reza Azad and Ehsan Khodapanah Aghdam and Julien Cohen-Adad and Dorit Merhof},
year={2023},
eprint={2207.08518},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2207.08518},
}