MaskFormer
6 memberslucid.models.vision.maskformerMaskFormer (Cheng et al., NeurIPS 2021).
Paper: "Per-Pixel Classification is Not All You Need for Semantic Segmentation"
Cheng, Bowen, et al. "Per-Pixel Classification is Not All You Need for Semantic Segmentation." Advances in Neural Information Processing Systems, 2021.
MaskFormer recasts semantic segmentation as a mask-classification problem rather than the standard per-pixel-classification one. Instead of predicting a -way softmax at every pixel, the model emits queries; each query produces a class label and a binary mask, and the final segmentation is the soft sum
where is the per-query class logit and is its binary mask logit. The argmax over yields the predicted label map.
The architecture has three modules:
- Pixel decoder — an FPN-like up-sampler that produces a per-pixel embedding .
- Transformer decoder — learnable queries attend to a flattened backbone feature, producing per-query embeddings .
- Heads — a linear classifier on each query and a dot-product to produce per-query masks.
Training uses Hungarian matching (as in DETR) between predicted and ground-truth segments and combines cross-entropy on the class logits with focal/BCE + Dice losses on the mask logits.
The key insight — that mask classification subsumes per-pixel classification — also unifies semantic and instance segmentation under one model, foreshadowing the more general Mask2Former.