Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Vision Transformers for Dense Prediction

Dense vision transformers replace convolutional backbones for dense prediction tasks

  • Problem Convolutional backbones shrink the feature grid with depth, so fine resolution and detail are lost before the decoder can recover them. Remedies only soften this, because they still rest on the convolution.
  • Method DPT uses a vision transformer as the encoder, which keeps a constant resolution and a global receptive field at every stage. It reassembles tokens from four layers into multi-resolution maps and fuses them with a convolutional decoder.
  • Results DPT-Hybrid reaches 49.02 mIoU on ADE20K, above the 48.36 mIoU of DeeplabV3 with ResNeSt-200.

Why convolutional backbones limit dense prediction

Most dense prediction networks pair a convolutional backbone with a decoder, and the backbone is usually an image classifier pretrained on ImageNet. The decoder can only work with what the encoder keeps, so the backbone sets a ceiling on the whole model. Convolutional backbones downsample the image to build features at several scales. This widens the receptive field and keeps memory and compute within reach.

The cost is that resolution and granularity fall off in the deeper stages, and the decoder then has to recover detail that is hard to bring back. Remedies such as higher input resolution, dilated convolutions, skip connections from several encoder stages, and parallel multi-resolution branches soften the problem. All of these still rest on the convolution, which is a linear operator with a limited receptive field, so depth must be stacked to see wide context and downsampling follows.

From image patches to tokens

DPT keeps the encoder-decoder layout and uses a transformer as the basic computational block of the encoder, specifically the vision transformer, ViT. ViT cuts the image into non-overlapping square patches of side p, flattens each one and embeds it linearly. Each embedded patch is one token. The patch size is 16 for all experiments.

Each transformer layer keeps the number of tokens unchanged, so the encoder holds the spatial grid of the initial embedding through all stages. Self-attention is global, since any token can influence any other token. From the embedding onward, every stage therefore has a global receptive field. Because the transformer treats tokens as a set, the embedding adds a learnable position embedding.

A readout token that is not tied to any patch is also added as a global image representation. The embedding width is 768 for ViT-Base and 1024 for ViT-Large, which is larger than the number of pixels in a patch, so the embedding can keep information the task needs. In the hybrid variant, a ResNet50 produces the image embedding, so tokens sit at a finer resolution than the lowest-resolution features that convolutional backbones usually expose.

Reassembling tokens into feature maps

The decoder starts with a three-step Reassemble operation that takes tokens from an arbitrary set of encoder layers and produces an image-like map at a chosen size ratio s. The first step, Read, maps the Np+1 tokens to Np tokens so that they can be placed on a grid, and it has to decide what happens to the readout token. Three options were compared: ignoring the readout token, adding it to every patch token, or concatenating it to each patch token and projecting the result back to D with a linear layer followed by GELU.

The projection option is the default, and the decoder then produces feature maps with 256 dimensions.

The second step, Concatenate, places each token at the position of its source patch, which gives a map of size H/p by W/p with D channels. The third step, Resample, first projects the channels to D̂ with a 1×1 convolution. It then uses a strided 3×3 convolution when s is at least p, and a strided 3×3 transpose convolution when s is less than p.

Four layers are tapped at four resolutions, with deeper layers placed at lower resolution. ViT-Large uses layers 5, 12, 18 and 24, while ViT-Base uses layers 3, 6, 9 and 12. The hybrid model takes features from the first and second ResNet blocks of the embedding network, together with stages 9 and 12 of the transformer.

Fusing stages and handling image size

Consecutive reassembled maps are merged in fusion blocks based on RefineNet, which uses residual convolutional units. Each fusion stage doubles the resolution, so the final representation sits at half the input resolution, and a task-specific head produces the output. For depth the head uses 3 convolutional layers, and batch normalization is turned off in the decoder because it hurt regression results.

For segmentation the head predicts at half resolution and bilinear interpolation restores the full size.

The encoder accepts any image size that is divisible by p, and the number of tokens then changes with the image. The position embeddings are interpolated to the new grid for each image, and the convolutional decoder requires inputs aligned to its stride of 32 pixels.

Monocular depth on the 1.4 million image meta-dataset

Training follows the protocol of Ranftl et al., with a scale- and shift-invariant trimmed loss on inverse depth and a gradient-matching loss. The training data is MIX 6, which extends the MIX 5 datasets with five more and contains about 1.4 million images. The encoder starts from ImageNet weights and is trained with Adam at a learning rate of 1e-5, while the decoder starts randomly and uses a learning rate of 1e-4.

Images are resized to a longer side of 384 pixels and trained on 384 by 384 crops for 60 epochs of 72,000 steps at batch size 16, after a pretraining stage on a curated subset.

The evaluation is zero-shot, so the test datasets are not seen in training, and relative numbers are computed against the original MiDaS model. On ETH3D, the AbsRel of DPT-Large is 0.089, against 0.116 for MiDaS retrained on MIX 6, and lower values are better. Averaged over the test datasets, the relative improvement over MiDaS is more than 23% for DPT-Hybrid and 28% for DPT-Large.

To separate the architecture from the larger training set, the authors retrained the MiDaS network on MIX 6. That network gains from the larger set, but both DPT variants still outperform it in the same zero-shot evaluation. The authors read this as evidence that DPT benefits more from more training data than the convolutional network does.

Fine-tuning on NYUv2 and KITTI

Because the meta-dataset model is trained with an affine-invariant loss, its outputs can have arbitrary scale and shift, and direct fine-tuning would be dominated by that mismatch. Each training sample is first aligned to its ground truth, the resulting scales and shifts are averaged over the training set, and the average is applied before the loss.

The Eigen loss is used, and the gradient-matching loss is disabled for KITTI because the ground truth there is sparse.

On NYUv2, DPT-Hybrid reaches a δ>1.25 of 0.904, against 0.885 for BTS, with an AbsRel of 0.110 for both and an RMSE of 0.357 against 0.392 for BTS. On KITTI (Eigen split), DPT-Hybrid reaches a δ>1.25 of 0.959, against 0.956 for BTS, and an RMSE of 2.573 against 2.756. BTS has the lower AbsRel on KITTI, 0.059 against 0.062 for DPT-Hybrid, so the authors' statement that the architecture matches or improves on all metrics holds only for the other metrics in that table.

Semantic segmentation on ADE20K and Pascal Context

The segmentation protocol follows Zhang et al., with a cross-entropy loss, an auxiliary head with loss weight 0.2 on the penultimate fusion layer, and dropout of 0.1 before the classifiers. Training uses SGD with momentum 0.9, a polynomial schedule with decay 0.9, batch size 48, a learning rate of 0.002 and 240 epochs on ADE20K, with multi-scale inference at test time.

The authors attribute the lower DPT-Large score to the much smaller ADE20K training set compared with their earlier depth experiments. Qualitatively, the authors observe cleaner and finer object boundaries and somewhat less clutter in the DPT predictions.

For Pascal Context, DPT-Hybrid is fine-tuned for 50 epochs with the other hyper-parameters unchanged.

Which design choices matter

The ablations use monocular depth with a reduced meta-dataset of three datasets, about 41,000 images, and a small validation split of about 1,000 images. Results are relative absolute deviation after affine alignment, and ViT-Base is the default backbone unless stated otherwise.

For the readout token, ignoring it gives a mean of 0.0822, adding it gives 0.0831 and projecting it gives 0.0819, so projection is the best mean of the three. Adding the token is worse than ignoring it, and the authors chose projection for all later experiments. For skip connections on ViT-Base, tapping layers 3, 6, 9 and 12 gives a mean of 0.0822, which is the lowest of the three base settings, while the hybrid model benefits from tapping the low-level ResNet stages R0 and R1.

ViT-Large has a mean error of 0.0778, below the 0.0819 of ViT-Base and the 0.0783 of ViT-Hybrid. ViT-Base is comparable to ResNext101-WSL, which had a billion-scale weakly supervised pretraining, while ViT-Hybrid and ViT-Large improve on it with less pretraining data. DeIT-Base-Dist, which has the same architecture as ViT-Base but a distillation token, has a mean of 0.0796 against 0.0819 for ViT-Base, which suggests that better classification pretraining also helps dense prediction.

Behaviour at inference resolutions above training

Fully-convolutional networks have large effective receptive fields only in their deepest layers, so their early layers stay local and performance drops when inference resolution differs from training. The authors test inference at resolutions from 416 to 640 pixels, above the 384 by 384 training resolution, and plot the relative performance decrease against the training-resolution result.

The DPT variants degrade more gracefully as resolution increases than the convolutional baselines do in these measurements. The authors conjecture that the global receptive field at every transformer layer is the reason, but this link was not isolated in a separate experiment.

Parameter counts and inference time

Timings were measured on an Intel Xeon Platinum 8280 CPU and an Nvidia RTX 2080 GPU, with 384-pixel square inputs averaged over 400 runs. Inference times are 32 ms for MiDaS, 17 ms for DPT-Base, 38 ms for DPT-Hybrid and 35 ms for DPT-Large, so the largest model is about as fast as the convolutional baseline on this hardware.

Limitations

The study covers two dense tasks, monocular depth and semantic segmentation. The authors state that vision transformers realize their potential when paired with a sufficient amount of training data, and the largest depth gains are reported with the 1.4 million image MIX 6 set. The ablations run on a reduced three-dataset setup with about 41,000 images and ViT-Base as the default, so they are not the same comparison as the full depth results.

The inference-resolution test covers resolutions from 416 to 640 pixels, and the link to the global receptive field is a conjecture. Timings come from one CPU and one GPU and are not tied to the accuracy experiments.

Paper info

Authors
René Ranftl, Alexey Bochkovskiy, Vladlen Koltun
Venue
arXiv · Preprint
First published
2021-3-24
Added
2026-11-12
Updated
2021-3-24
Version
v1
arXiv
2103.13413
Category
cs.CV
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

René Ranftl, Alexey Bochkovskiy, Vladlen Koltun (2021). Vision Transformers for Dense Prediction. arXiv:2103.13413v1. https://arxiv.org/abs/2103.13413v1

BibTeX
@misc{ranftl2021vision,
  title = {{Vision Transformers for Dense Prediction}},
  author = {René Ranftl and Alexey Bochkovskiy and Vladlen Koltun},
  year = {2021},
  eprint = {2103.13413},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2103.13413v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up