All models

MCTformer

A vision transformer with multiple class tokens that yields class-specific localization maps from image-level labels.

Segmentation · 352 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 (10 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
21.7M
Operations
352
Framework
PyTorch
Recurrent
No
Published
CVPR 2022
Cited by
322 (as of 24 October 2026)
Authors
Lian Xu, Wanli Ouyang, Mohammed Bennamoun 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
m18063
Graph hash
cb6bb0052e5ff7a7a68ccb2bfafe3bd179707d7ade092996c6463088c406a113
Skeleton hash
320ec44a6e0f548d7c956c8dca0e7721732ec98b96f1dbae21106a6917482e0f
Architecture hash
d22488ce6c8c182f3c532913b796d4c51e5c2654b8b8f92f2485e77953e7a447
Diagram SHA-256
d4ececc15456be3affa7bf9d8769c058e010bfaf37ed3e64e902822d4a6022da
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

MCTformer, the Multi-class Token Transformer, is a transformer-based framework that learns class-specific object localization maps to use as pseudo labels for weakly supervised semantic segmentation (WSSS). Where a conventional transformer uses one class token, MCTformer uses multiple class tokens. Class scores come from average pooling over the output class tokens and are supervised directly by the class labels, which ties each token to one class. The class-to-patch attention of each token can then be used directly as the localization map of its class.

This model is MCTformer-V2 with a DeiT-small backbone. V2 is the extended version that integrates a CAM (Class Activation Mapping) module, made of a convolutional layer and a global average pooling layer, on the output patch tokens. It therefore produces two sets of class predictions, one from the class tokens and one from the patch tokens, each with its own classification loss.

The paper also takes the patch-to-patch attention as a patch-level pairwise affinity to refine the localization maps. It reports segmentation mIoU of 71.6% on the PASCAL VOC test set and 42.0% on MS COCO. The segmentation network itself is separate: the paper uses a ResNet38 based Deeplab V1 for that step.

Key idea. MCTformer gives a vision transformer one class token per class, so that each token's class-to-patch attention serves as a class-specific object localization map for weakly supervised semantic segmentation.

  • MCTformer
  • Multi-class Token Transformer
  • MCTformer-V2
  • weakly supervised semantic segmentation
  • WSSS
  • class-specific localization maps
  • multiple class tokens
  • pseudo labels

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

Cite the paper

@misc{xu2022multiclasstokentransformerweakly,
      title={Multi-class Token Transformer for Weakly Supervised Semantic Segmentation}, 
      author={Lian Xu and Wanli Ouyang and Mohammed Bennamoun and Farid Boussaid and Dan Xu},
      year={2022},
      eprint={2203.02891},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2203.02891}, 
}