Add DPT
# What does this PR do?

This PR adds [DPT](https://arxiv.org/abs/2103.13413), Dense Prediction Transformers, to the library. It's some very nice work from Intel Labs that applies Transformers for dense prediction tasks such as semantic segmentation and depth estimation.

Feel free to play around with the notebook [here](https://colab.research.google.com/drive/177o79Qm8qsjGDQk5TDSS4tawcFNSZsy8?usp=sharing). 

I've defined 3 models:

* `DPTModel`
* `DPTForDepthEstimation`
* `DPTForSemanticSegmentation`.

DPTModel is the backbone only (ViT in this case). The head models use a neck (DPTNeck) combined with a task-specific head (either `DPTDepthEstimationHead` or `DPTSemanticSegmentationHead`).

Important here:
* a neck is an nn.Module that takes a list of tensors and produces another list of tensors.
* a head takes a list of tensors and return `logits`.

To do:

- [x] make sure heads take a list of tensors as input
- [x] add tests for `DPTFeatureExtractor`
- [x] discuss `out_indices` and `in_index` names
- [x] transfer weights to `Intel` organization
_The documentation is not available anymore as the PR was closed or merged._<|||||>Thanks for your reviews, addressed most comments. Main thing to update is:
* rename `out_indices` (which features to use from the backbone)
* rename `in_index` (which features to use in the head)

Ideally we have names that are going to be used by all vision models.<|||||>stop with all the emails I’m getting mad



Sent from my iPhone

> On Mar 11, 2022, at 8:37 AM, NielsRogge ***@***.***> wrote:
> 
> ﻿
> @NielsRogge commented on this pull request.
> 
> In src/transformers/models/dpt/modeling_dpt.py:
> 
> > +            if output_attentions:
> +                all_self_attentions = all_self_attentions + (layer_outputs[1],)
> +
> +        if output_hidden_states:
> +            all_hidden_states = all_hidden_states + (hidden_states,)
> +
> +        if not return_dict:
> +            return tuple(v for v in [hidden_states, all_hidden_states, all_self_attentions] if v is not None)
> +        return BaseModelOutput(
> +            last_hidden_state=hidden_states,
> +            hidden_states=all_hidden_states,
> +            attentions=all_self_attentions,
> +        )
> +
> +
> +class DPTReassembleBlocks(nn.Module):
> Renamed to DPTReassembleStage
> 
> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> Triage notifications on the go with GitHub Mobile for iOS or Android. 
> You are receiving this because you are subscribed to this thread.
