Maskformer
Author: FrancescoSaverioZuppichini
Pull request: yes

# What does this PR do?
This WIP PR adds [MaskFormer](https://arxiv.org/abs/2107.06278) a new model for any segmentation task. This model ranks [on the top 10 of almost every task](https://paperswithcode.com/paper/per-pixel-classification-is-not-all-you-need)


A total of 8 pre-trained checkpoints will be available, which are the checkpoints discussed in the official MaskFormer paper. They are not yet available on the hub but tested locally. The weights are all pairs of combinations between the 4 Swin Transformer variants (tiny, small, base and large) and two datasets ([ade20k-150](https://groups.csail.mit.edu/vision/datasets/ADE20K/) and [coco-panoptic](https://cocodataset.org/#home))

TODOs
  - [x] converting script should be self-contained
    - currently, the job of downloading the weights and configuration files is outsourced to the end-user
  - [x] feature extractor
    - all the parameters needed are there, but the class is missing
    - the resizing needed is tricky, originally [ResizeShortestEdge](https://detectron2.readthedocs.io/en/latest/modules/data_transforms.html#detectron2.data.transforms.ResizeShortestEdge) from detectron is used 
    - all the post processing should be inside it
  - [x] backbone
    - recently we added [Swin Transformer](https://github.com/huggingface/transformers/pull/15085), the backbone should depend on that implementation
    - ported inside maskformer with the required changes
  - [x] loss
    - originally, the loss is computed by passing a list of dictionaries representing targets. However, this approach is subefficient since different targets may have different sizes making it hard to process the batch in a single go.
  - [x] padding
    - padding is handled in the forward pass using `NestedTensor`, this is a well know class used in a lot of implementations. This should be handled by the `FeatureExtractor` following [Niels implementation](https://github.com/huggingface/transformers/blob/c15bb3fe19b0b6c69a727812cdd3cd5597014667/src/transformers/models/detr/feature_extraction_detr.py#L633)
  - [x] auxiliary loss is not yet implemented
  - [x] output_hidden_states
  - [x] doc
  - [x] tests:
    - [x] FeatureExtractor
    - [x] MaskFormer
        
Currently, the model can be used as follows

```python
import torch

from transformers import (
    MaskFormerModel,
    MaskFormerForInstanceSegmentation,
    MaskFormerConfig,
    MaskFormerFeatureExtractor,
)

import numpy as np

feature_extractor = MaskFormerFeatureExtractor(do_resize=True)

inputs = feature_extractor(
    [np.zeros((3, 400, 1200)), np.zeros((3, 750, 384))],
    return_tensors="pt",
    pad_and_return_pixel_mask=True,
)

config = MaskFormerConfig()
mask_former = MaskFormerModel(config=config)
out = mask_former(**inputs)
# out contains the hidden states of each submodule
mask_former = MaskFormerForInstanceSegmentation(config=config)
out = mask_former(**inputs)
# out contains the logits
seg = feature_extractor.post_process_segmentation(out)
# get the instance panoptic mask + segments
seg = feature_extractor.post_process_panoptic_segmentation(out)
```


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_15682). All of your documentation changes will be reflected on that endpoint.

Thanks for the comments. Changed all instances of `detr_**` to `decoder_**` in the config + minor fixes and typos. Currently uploading the new weights and testing if everything is correct