All models

dpt (depth estimation)

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

Segmentation · 413 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 (26 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
110.9M
Operations
413
Framework
PyTorch
Recurrent
No
Published
ICCV (arXiv 2021)
Authors
René Ranftl, Alexey Bochkovskiy, Vladlen Koltun
Name in source
dpt:depth-estimation
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
m4377
Graph hash
fa7fdb2ed5ea86cf38b8c5515b331d52bfc0cc87c8c3d10a4a071a74e85b2dee
Skeleton hash
5ee5700da6dac126ee9d0dada6f027947852cd91f8b3161c7c81992eb4698629
Architecture hash
6b4e0ed48c74f156b7350ed0705f564c20fa6066c3c6f3939ff743f47819116f
Diagram SHA-256
094ebda997d89681ac9b6250aeb3b3dd32d2f330008b4aac3d91a4e5eb97fda4
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

transformers.AutoModelForDepthEstimation.from_config()

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