All models

smp_DPT_tu_beit_base_patch16_224

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

Segmentation · 537 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
121.7M
Operations
537
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
m9227
Graph hash
d93252f52d229cfba7be842805b5d8d213bf2ba0232fd2b20dd5f9c2bffa68b6
Skeleton hash
be9234153726aa4420cf049aa79893c3dcc6b72f99f276f33c56d0d13898c6a9
Architecture hash
446719b14ac70ee7193ef69d470193493ef73ce828d078d3718f71d98c5196f9
Diagram SHA-256
d8761e67e5039870f75e41c4d23b8a54ce1160e5db822fcfdd5e2731e5be2bb0
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-beit_base_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}, 
}