All models

smp_DPT_tu_vit_tiny_patch16_224

A vision transformer backbone with a convolutional decoder for per-pixel segmentation and depth.

Segmentation · 492 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 (29 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

Family
DPT
Parameters
34.9M
Operations
492
Framework
PyTorch
Recurrent
No
Published
ICCV (arXiv 2021)
Authors
René Ranftl, Alexey Bochkovskiy, Vladlen Koltun
License
MIT
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
m9240
Graph hash
35e581b6bce6b3a1b9063827965c84682c9b1b2e071017e8ea43c0758de8758b
Skeleton hash
49e7c30496a17a3de4b6856e29eea5b50625c664767047fb500c15ffe8434e82
Architecture hash
fbc058b4c6090b717992e5070be8e1f2cb0f70ccad13ad28644d4195542b41ed
Diagram SHA-256
59ce7541070ceccb626317c5cf51049c633039ad732b9673f5becd04c4ccd06b
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

segmentation_models_pytorch.DPT(encoder_name='tu-vit_tiny_patch16_224', encoder_weights=None, in_channels=3, classes=21)

What it is

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.

  • DPT
  • dense prediction transformer
  • dense vision transformer
  • Vision Transformers for Dense Prediction
  • DPT-Large
  • DPT-Hybrid
  • DPT-Base
  • semantic segmentation
  • monocular depth estimation
  • segmentation_models_pytorch DPT
  • DPTForDepthEstimation
  • DPTForSemanticSegmentation
  • ViT backbone

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

Cite the paper

@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}, 
}