Enable `image-segmentation` on `AutoModelForSemanticSegmentation`
# What does this PR do?

Enable `image-segmentation` on `AutoModelForSemanticSegmentation`

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@NielsRogge 
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->
_The documentation is not available anymore as the PR was closed or merged._<|||||>> I think it's a mistake to group together tasks as different as instance segmentation and semantic segmentation in the same pipeline, especially when we haven't fully defined the instance segmentation outputs yet.

It's a long standing debate between us, and I think we just need to define what are pipelines really and have a proper design doc on which we agree on.
I think I understand your position, but I think we differ on the premises.


IMHO, what defines a pipeline is IN ORDER:

- Achieve a given task, targeted towards non-ml python programmers, hiding as many ML details without misleading users (transformers have a limited range of attention, so this shouldn't be hidden).
- A task, is a set of input/output. For simplicity, aim to core python types first `str`,  `dict`, `list`, `int`, `float`. Use "accepted standards" everywhere possible (`PIL.Image` for Python images for instance). 
- Compromise as little as possible performance wise.
- Parameters should enable advanced usage/tweaks only. Users shouldn't have to use them on standard usage.

That means:

- `AutoModelForXXX` 1-1 mapping with a task is not something which makes sense in general (`automatic-speech-recognition` does ASR both for CTC, and Seq2seq, and users shouldn't have to care about the difference between those two things).Input: `audio` -> output: `str` *is* what defines the pipeline here.




> 
> It's as if we grouped token classification and text classification in the same task for NLP, just because they both have classification in their names, in my opinion

Well `token-classification` is the same thing as `text-segmentation` actually (it's just not being used as a name by the community). If we follow the guidelines I suggest, the pipeline should actually never mention `tokens` (it's an ML concept). What non ML users should care about is "part of text" (because "words" is not necessarily what you are looking for

My personnal picture is that more generally, for an input set K ⊂ Ω:

classification are applications such that  `K -> [0; n]`
segmentation :  ` K -> {M,  M ⊂ K}` (parts of K)
generation: `K -> {K_i, K_i ⊂ Ω}` (new members of Ω)

This applies to Audio, Image, and Text pretty fine I think.

> 
> It would be cleaner to have a separate `semantic-image-segmentation`.

<|||||>> A task, is a set of input/output. For simplicity, aim to core python types first str, dict, list, int, float. Use "accepted standards" everywhere possible (PIL.Image for Python images for instance).

This is the crux of the problem. Instance segmentation and semantic segmentations have very different kinds of outputs. Grouping them in the same pipeline will be confusing to the user and it make the code unreadable, so I really don't see why we should group them in the same alias.<|||||>Major modifications with breaking changes linked to a good compromise we found with @sgugger .

My major opposition for creating a separate pipeline were:
- It adds complexity on non ML (users need to know about the differences between 200 tasks) with sometimes only minor differences in what a user actually cares for (where is the tumor located on the image, and how big is it ?)
- It forces users to use odd matrix `[[0, 2, 9], [0, 2, 2], ...]`  which are not real images but classes ids 2D array, which are confusing when you try to display them as they are pure black when displayed in colab for instance

@sgugger main opposition to a single pipeline
- We're trying to force feed different outputs in the same object where they are not really the same thing
  - Discussing further, the real problem is the confusion that stems from `parameters` which could be different for `Semantic` vs `Image segmentation` or `panoptic`. This is definitely an issue with parameters in general for pipelines.
  - `score` is a good example, in semantic segmentation it's not really meaningful, people mostly look at individual pixel logits, not really at the full cluster
- semantic segmentation can output a single mask for 2 persons, it could be confusing.

- Consensus, was to really aim on outputting at "non ML" objects.
Most ML users that want the details, should be able to use the raw AutoModelForXX, or even override the pipelines to modify subtle things. It might be something to explore, document more  in the future, but the core target for pipeline are non ML users, so we're ok giving up some something to get simplicity.
- `scores` don't make sense for semantic, so don't attempt to give them for semantic.

We're also working on a pipeline guidelines, to help guide us in decision, we'll work on this a bit internally, and release later on a wider audience to get community feedback.

```
- Removed the string compressed PNG string, that's a job for and API. `transformers` 's users
 stay in python land.
- Removed the `score` for semantic segmentation. It has hardly a meaning
  on its own in this context.
- Don't include the grayscale with logits for now (which could enable
  users to get a sense of confidence). Might be done later.
- Don't include the surface of the mask (could be used for sorting by
  users, to filter out small masks). It's already calculable, and
  it's easier to add later, than to add now and break later if we need.
```<|||||>@sgugger Since this contains a breaking change, should I wait after the release the make the change or not ?<|||||>I see this more as a bug fix than a breaking change, but let's see what @LysandreJik thinks.
Lysandre, for context, the pipeline used to return string for masks (so they can be used in the inference API) and it would return mask as PIL images now. I think it's completely okay since it makes the output of the pipeline more readable.