[MaskFormer] Add doc tests
# What does this PR do?

This PR fixes all code snippets for MaskFormer, and makes sure they are tested. None of them actually ran without issues. It makes a distinction between semantic and panoptic segmentation.

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