Factored out some code in the `image-segmentation` pipeline.
# What does this PR do?

Modifies the pipeline's internal a little.

- Hopefully less code, so easier to read.

- Removed the "blank mask" when nothing gets detected. Sending `[]` instead
  is more obvious IMO (and used to be the behavior, so making it non breaking change).
  
- Changed the default of `subtask` to `None` instead of `semantic`. `panoptic` used to be the default, and I merely adopted the same behavior. If a user specifies `subtask=x` we definitely try to use it's task and error out when it's impossible. But when nothing gets passed (should be the most common case), then we try **in order** `"panoptic", "instance", , and "semantic"`. Since roughly they are in decreasing order of expressiveness.

- Added `Detr` as an exception to sending empty lists in the randomly generated
  models (Like maskformer, it *can* return nothing because it has an empty slot
  it seems)
  
- Renamed `task` to `subtask` since `pipeline(task="image-segmentation")` already exists and would be impossible to use from `pipeline` directly. I feel `subtask` is appropriate but welcome any suggestions there.

TODO : figure out the real bug that makes `panoptic` on the tiny detr:

Figured it out. Not sure what the original code was doing but it was outputting two masks for LABEL_215.
What happens is that `pred_masks` is a tensor of shape `(2, H, W)` where `2` is the number of class queries.
Now we only have one mask because we have for all pixels `pred_masks[0, :, :] == pred_masks[1, :, :]`. So when we do
`pred_masks.argmax(dim=0)` to get the class they are associated with, everything gets attributed to class 0, and no pixel to class 1.
Since mask 1 is empty, we exclude it (which is good).

<!--
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/main/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/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

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._<|||||>Okay, I've pinpointed out the filter that filters OUT the prediction for panoptic:
(https://huggingface.slack.com/archives/D03VB3U5CVC/p1666108719919289)
36f52e9593
(https://huggingface.slack.com/archives/D03VB3U5CVC/p1666108795507369)
It's this line specifically : https://github.com/huggingface/transformers/pull/19262/files#diff-826e0e0303aa4a12e527884e4dc548fe8debb137905260e42ec8b4331c9c2c63R199
(https://huggingface.slack.com/archives/D03VB3U5CVC/p1666108939394469)
For the random model, the predictions are rather low (score == 0.004) and so >0.5 filter them out, basically loosing the predictions right there.I'm not sure who is correct, but as mentionned earlier, if semantic is saying something, I feel like panoptic without any thresholds should ALWAYS output at least as much.

I think the >0.5 comes from the expectations that sigmoid would have put the range of probs into something normalized and make sure something was in the >0.5 range.I don't really have the time to figure out where the logic fails (if it does) ?

Without this line I recover a `LABEL_215` label in the `small_model_pt` test (not two though) but with the same score, which is encouraging IMO.<|||||>@alaradirik @amyeroberts This PR is ready for review.

Don't hesitate to voice any concern over the changes. This mostly code cleanup. Except for the empty mask being removed (which wasn't the behavior before, and is not tested against).