# Mask2Former (2021)

> Unified semantic, instance and panoptic segmentation into one mask-predicting Transformer with masked cross-attention.

Page: https://mralbu.github.io/ai-datasets/p/mask2former

## Key facts

- Title: Masked-attention Mask Transformer for Universal Image Segmentation
- Authors: Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar
- Venue: CVPR 2022
- Category: Vision
- Paper: https://www.alphaxiv.org/abs/2112.01527

## Why it matters

For a decade, semantic segmentation (labeling stuff like sky and road) and instance segmentation (separating individual cars and people) used different heads, losses and toolboxes. Mask2Former proved that mask classification with a Transformer can handle every segmentation task at once without giving up state-of-the-art accuracy.

## The idea

Instead of classifying every pixel independently, predict a fixed set of binary masks and class labels from learned object queries—just as DETR predicts boxes. Inside the Transformer decoder, restrict each query's cross-attention to the foreground region predicted by the previous layer (masked attention) and feed multi-scale feature maps round-robin so small objects stay sharp.

## The result

57.7% mIoU on ADE20K semantic segmentation, 50.1 AP on COCO instance segmentation, and 57.8 PQ on COCO panoptic segmentation with a Swin-L backbone—beating specialized models on all three tasks with one architecture.

## The data

- [ADE20K (2017)](https://mralbu.github.io/ai-datasets/d/ade20k.md): 27,000 scenes where every object, and often its parts, is outlined and named.
- [Cityscapes (2016)](https://mralbu.github.io/ai-datasets/d/cityscapes.md): 5,000 street photos from 50 cities, every pixel labeled as road, car, person, sky and so on.
- [MS COCO (2014)](https://mralbu.github.io/ai-datasets/d/coco.md): 330k everyday scenes with 1.5M labeled objects in 80 categories.

## Builds on

- [DETR (2020)](https://mralbu.github.io/ai-datasets/p/detr.md)
- [Mask R-CNN (2017)](https://mralbu.github.io/ai-datasets/p/mask-rcnn.md)
- [SegFormer (2021)](https://mralbu.github.io/ai-datasets/p/segformer.md)

## Part of

- [Segmentation](https://mralbu.github.io/ai-datasets/t/segmentation.md) (step 6 of 7)
