
smp_DPT_tu_swin_small_patch4_window7_224
Segmentation1,421 ops68.5M params
A vision transformer backbone with a convolutional decoder for per-pixel segmentation and depth.
Segmentation · 417 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.
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.
How this diagram was made
transformers.AutoModelForSemanticSegmentation.from_config()
About this model's family
DPT, the dense prediction transformer, replaces the convolutional backbone of a dense prediction network with a vision transformer and keeps a convolutional decoder to turn the tokens back into a per-pixel output. The reason to care is resolution: the transformer backbone processes representations at a constant and relatively high resolution and has a global receptive field at every stage, which the authors argue is exactly what per-pixel tasks need. Convolutional backbones, by contrast, downsample as they go, so feature resolution and granularity are lost in the deeper stages of the model and can be hard to recover in the decoder.
The decoder's key piece is a three-stage Reassemble operation that recovers image-like representations from the output tokens of arbitrary layers of the transformer encoder. Whatever the backbone, features are reassembled at four different stages and four different resolutions, with deeper layers assembled at lower resolution. A RefineNet-based fusion block then combines consecutive stages and progressively upsamples the representation by a factor of two in each fusion stage, so the final representation has half the resolution of the input image. The class token, which the paper calls the readout token, gets its own Read step, and the ablation found that fusing it into the other tokens through a projection layer yields the best performance. Three backbones are defined: ViT-Base with 12 transformer layers, ViT-Large with 24 layers and a wider feature size, and ViT-Hybrid, which computes the image embedding with a ResNet50.
The depth models were trained on a meta-dataset the authors call MIX 6, which contains about 1.4 million images. For monocular depth estimation the paper reports an improvement of up to 28% in relative performance over a state-of-the-art fully-convolutional network. For semantic segmentation the same architecture set a new state of the art on ADE20K with 49.02% mIoU.
The traced members come from three codebases, and the segmentation_models_pytorch build takes a timm classification model as its encoder and, because that backbone is a vision transformer, typically requires a fixed input image size. In Hugging Face Transformers the DPT decoder is compatible with the AutoBackbone class, so the same framework can sit on other computer vision backbones available in the library. The authors released their models at github.com/intel-isl/DPT.
Key idea. Replacing the convolutional backbone of an encoder-decoder dense prediction network with a vision transformer, assembling tokens from several of its stages into image-like representations at several resolutions and combining them with a convolutional decoder into a full-resolution prediction.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{ranftl2021visiontransformersdenseprediction,
title={Vision Transformers for Dense Prediction},
author={René Ranftl and Alexey Bochkovskiy and Vladlen Koltun},
year={2021},
eprint={2103.13413},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2103.13413},
}