Mask2Former
10 memberslucid.models.vision.mask2formerMask2Former (Cheng et al., CVPR 2022).
Paper: "Masked-attention Mask Transformer for Universal Image Segmentation"
Cheng, Bowen, et al. "Masked-attention Mask Transformer for Universal Image Segmentation." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 1290–1299.
Mask2Former generalises MaskFormer into a single architecture that wins on semantic, instance, and panoptic segmentation simultaneously. It keeps the mask-classification framing — object queries each predict a class and a binary mask — and improves it with three orthogonal changes.
Masked cross-attention. In every decoder layer the queries attend only to feature locations that the previous layer already considered foreground for that query:
where if the predicted binary mask of query at layer activates pixel and otherwise. This confines query updates to plausible mask regions and accelerates convergence.
Multi-scale features. The decoder layers cycle through three pyramid levels of an enhanced FPN-style pixel decoder, so high-resolution semantic detail and broad contextual features are both available to every query.
Improved pixel decoder. A multi-scale deformable-attention encoder fuses the backbone feature maps before producing the per-pixel embeddings against which the query embeddings are dotted to form binary masks.
Training uses the same Hungarian-matched class CE + mask BCE/Dice losses as MaskFormer (with auxiliary losses at intermediate decoder layers). Mask2Former sets a new SOTA on each of ADE20K, Cityscapes, and COCO with a single model, eliminating the need for task-specific architectures.
Classes
Functions
mask2former_swin_tiny→ Mask2FormerForSemanticSegmentationMask2Former with Swin-Tiny backbone (Cheng et al., CVPR 2022).
mask2former_swin_small→ Mask2FormerForSemanticSegmentationMask2Former with Swin-Small backbone (Cheng et al., CVPR 2022).
mask2former_swin_base→ Mask2FormerForSemanticSegmentationMask2Former with Swin-Base backbone (Cheng et al., CVPR 2022).
mask2former_swin_large→ Mask2FormerForSemanticSegmentationMask2Former with Swin-Large backbone (Cheng et al., CVPR 2022).
Weights
Mask2FormerSwinTinyWeightsPretrained weights for lucid.models.mask2former_swin_tiny.
Mask2FormerSwinSmallWeightsPretrained weights for lucid.models.mask2former_swin_small.
Mask2FormerSwinBaseWeightsPretrained weights for lucid.models.mask2former_swin_base.
Mask2FormerSwinLargeWeightsPretrained weights for lucid.models.mask2former_swin_large.