All models

BA-Transformer

A CNN-transformer hybrid that segments skin lesions with boundary-wise attention gates.

Medical imaging · 748 operations Checked

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 (21 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
46.7M
Operations
748
Framework
PyTorch
Recurrent
No
Published
MICCAI 2021
Cited by
219 (as of 26 October 2026)
Authors
Jiacheng Wang, Lan Wei, Liansheng Wang and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

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

Details
Stable ID
m14795
Graph hash
fe1bc7d6ef5c6973d0c2005e15dafe9bebaa7bf9b4fbbd815f7b8d65d47da0a7
Skeleton hash
e17374dfab8a3af5d01d6af753bca83a252d97556d451bdec13c257d2124df71
Architecture hash
0e998001850a555959eec2ff32a6cbe98c7717e1a19db09ad238acf89cc5b9b7
Diagram SHA-256
d344f3fa47c86eaa0d153b8f543451117aca8eb650044604d082f05f5abc53df
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

BA-Transformer (BAT) is a boundary-aware transformer built to segment skin lesions in dermoscopy images. The paper starts from a weakness of transformers in segmentation: they model global context well but do not extract enough local detail to handle ambiguous lesion boundaries.

A CNN backbone, ResNet50 by default, first turns the image into a feature map, which is flattened into a patch sequence for a transformer encoder. At the end of each encoder layer sits a boundary-wise attention gate (BAG), which predicts a patch-wise map of the patches that lie on an ambiguous boundary and uses it to refine the features. Each predicted key-patch map is supervised with a Cross-Entropy loss against a ground-truth map, alongside a Dice loss on the segmentation. An atrous prediction step then concatenates dilated-convolution features with different receptive fields and projects them into the segmentation map.

The paper reports that, compared with TransUNet, BAT improves segmentation by 1.8% on Dice and 2.1% on IoU. Images were resized to 512 × 512 in the experiments, and the number of transformer encoder layers is set to 4 by default. The code is the official release of the MICCAI 2021 paper, and the authors later released a follow-up, XBound-Former.

Key idea. The paper adds a boundary-wise attention gate to each transformer encoder layer so the network models global context while attending to patches on ambiguous lesion boundaries.

  • BA-Transformer
  • BAT
  • boundary-aware transformer
  • skin lesion segmentation
  • dermoscopy
  • boundary-wise attention gate
  • medical image segmentation
  • melanoma

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

Cite the paper

@misc{wang2021boundaryawaretransformersskinlesion,
      title={Boundary-aware Transformers for Skin Lesion Segmentation}, 
      author={Jiacheng Wang and Lan Wei and Liansheng Wang and Qichao Zhou and Lei Zhu and Jing Qin},
      year={2021},
      eprint={2110.03864},
      archivePrefix={arXiv},
      primaryClass={eess.IV},
      doi={https://doi.org/10.1007/978-3-030-87193-2_20},
      url={https://arxiv.org/abs/2110.03864}, 
}