All models

MedFormer

MedFormer is a hybrid Transformer for 3D medical image segmentation that trains from scratch on small datasets.

Medical imaging · 1,411 operations Structure only

Structure-only capture: TorchLens recorded this graph without running real numbers through the model, so shapes and data types on the diagram are hypotheses, not measurements.

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (37 KB)

Open in a new tab

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

Parameters
36.7M
Operations
1,411
Framework
PyTorch
Recurrent
No
Published
2022
Cited by
202 (as of 16 November 2026)
Authors
Yunhe Gao, Mu Zhou, Di Liu and others
License
Apache-2.0
Checked
Structure only: shapes and data types are hypotheses, not measurements.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m18366
Graph hash
678f40f37a715e55554a83886d1642796b8678357d65a8f631e17c71e5e0b1ff
Skeleton hash
cae59364dffdcfedbd2ae6f2f911e641a3e418ab59ec89a31d2aff3c9613a078
Architecture hash
821d529d8967ee9622633a8c555bc28f346672ebd3150fc4022a848f10d6f75c
Diagram SHA-256
53c22a2d07a8cbf19e999c9078dacfa516d92d0c46e29143021be02834cc4c6b
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3

What it is

MedFormer is a hybrid Transformer for 3D medical image segmentation. Its stated aim is to train from scratch even on extremely small medical datasets, without pre-trained weights. The paper starts from the observation that earlier Transformer segmentation models often fail to generalize as effectively as UNet.

To give the Transformer blocks a useful inductive bias, the projection and feed-forward network use depth-wise separable convolution. The attention module, bidirectional multi-head attention (B-MHA), removes redundant tokens by low-rank projection and brings the quadratic cost of ordinary self-attention down to linear. A convolutional stem of residual blocks and down-sampling layers first embeds the input image into 4× down-sampled token maps. During training, deep supervision adds an auxiliary loss on the output of the last B-MHA block in the decoder, so that the Transformer part is not bypassed by the convolutional stem.

The paper reports that MedFormer outperforms CNNs and vision Transformers on seven public datasets covering several imaging modalities, including CT and MRI. The official code is a PyTorch framework that provides fair evaluation and comparison of CNNs and Transformers on multiple medical image datasets.

Key idea. MedFormer combines a convolutional inductive bias, linear-complexity attention and global multi-scale feature fusion so that a Transformer can segment 3D medical images without pre-training.

  • medformer
  • medical transformer
  • 3d medical image segmentation
  • medical image segmentation
  • b-mha
  • bidirectional multi-head attention
  • data-scalable transformer
  • ct segmentation
  • mri segmentation

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gao2023datascalabletransformermedicalimage,
      title={A Data-scalable Transformer for Medical Image Segmentation: Architecture, Model Efficiency, and Benchmark}, 
      author={Yunhe Gao and Mu Zhou and Di Liu and Zhennan Yan and Shaoting Zhang and Dimitris N. Metaxas},
      year={2023},
      eprint={2203.00131},
      archivePrefix={arXiv},
      primaryClass={eess.IV},
      url={https://arxiv.org/abs/2203.00131}, 
}