Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Masked-attention Mask Transformer for Universal Image Segmentation

Mask2Former uses one architecture for panoptic, instance and semantic segmentation

  • Problem Panoptic, instance and semantic segmentation each have specialized architectures. Universal architectures that cover all three have trailed them in accuracy and training cost.
  • Method Mask2Former is a Transformer decoder that replaces standard cross-attention with masked attention. Each query attends only inside its own predicted mask region, instead of every image location.
  • Results With a Swin-L backbone, it reaches 57.8 PQ on COCO panoptic and 57.7 mIoU on ADE20K semantic segmentation, beating the best specialized models.

Why universal segmentation has not replaced specialized models

Panoptic, instance and semantic segmentation differ in the semantics used to group pixels, yet each has been handled by its own specialized architecture. Semantic segmentation has mostly used per-pixel classification networks, while instance-level segmentation is dominated by mask classification networks, so the design and optimization effort is duplicated across tasks.

Universal architectures handle all three tasks with one design trained by an end-to-end set prediction objective, but each task and dataset still gets its own training run. The best reported universal result on instance segmentation is more than 9 AP below the specialized Swin-HTC++ model.

Training is also heavier: MaskFormer needs 300 epochs to reach 40.1 AP and can fit only one image on a 32G GPU, whereas Swin-HTC++ reaches higher accuracy in 72 epochs.

Masked attention as a localized cross-attention

The authors hypothesize that local features are enough to update the query features and that global context can instead be gathered through self-attention.

In standard cross-attention with a residual path, the query features of layer l are updated as \( X_l=\operatorname{softmax}(Q_lK_l^{T})V_l+X_{l-1} \), where \( Q_l=f_Q(X_{l-1}) \) and \( K_l, V_l \) are projections of the image features over \( H_lW_l \) locations. Every query therefore reads from every image location.

Masked attention adds a mask \( M_{l-1} \) to the logits before the softmax, giving \( X_l=\operatorname{softmax}(M_{l-1}+Q_lK_l^{T})V_l+X_{l-1} \). The mask entry at each location is 0 where the binarized prediction from the previous layer equals 1 and negative infinity elsewhere, so positions outside the predicted region receive no attention weight.

That binary mask is the previous layer's mask prediction thresholded at 0.5 and resized to the resolution of \( K_l \); \( M_0 \) is taken from the initial query features \( X_0 \) before the decoder runs.

Feeding high-resolution features one scale per layer

High-resolution features improve performance on small objects, but attending over them in every layer is costly. Instead of using the finest map throughout, the decoder draws on a feature pyramid and feeds one resolution to one decoder layer at a time.

The pixel decoder supplies feature maps at 1/32, 1/16 and 1/8 of the input resolution. Each scale receives a sinusoidal positional embedding and a learnable scale-level embedding, and the three scales are consumed from lowest to highest resolution in a cycle that is repeated L times, giving 3L decoder layers in total.

In the ResNet-50 ablation, a single 1/32 scale reaches 41.5 AP, 50.2 PQ and 46.1 mIoU at 218G FLOPs, while a single 1/8 scale reaches 44.0 AP, 51.8 PQ and 47.4 mIoU at 239G FLOPs. The round-robin schedule reaches 43.7 AP, 51.9 PQ and 47.2 mIoU at 226G FLOPs, while feeding all three scales to every layer costs 247G FLOPs for 44.0 AP, 51.9 PQ and 46.3 mIoU.

Three decoder changes that add no computation

A standard decoder layer applies self-attention, then cross-attention, then a feed-forward network, starts from zero-initialized query features, and applies dropout to residual connections and attention maps.

The first change moves self-attention after masked attention, since queries entering the first self-attention carry no image signal and are unlikely to gain information from it. The second makes the query features learnable and supervises them before the decoder, so that their predicted masks act like region proposals. The third removes dropout, which the authors found to lower performance more often than not.

Sampled-point mask losses

High-resolution mask prediction makes training memory heavy, so the mask loss is computed on K randomly sampled points rather than on the full mask, following PointRend and Implicit PointRend. In bipartite matching, one set of K points is drawn uniformly and shared by all predicted and ground-truth masks, while the final loss draws a different set of K points for each prediction and ground-truth pair by importance sampling.

K is set to 12544, that is 112 by 112 points. Per image, training memory falls from 18GB to 6GB, a 3x reduction.

Changing only the final loss to sampled points cuts memory from 18G to 6G, with AP at 41.0 and mIoU at 45.9 in both settings while PQ rises from 50.3 to 50.8. Sampling in the matching loss as well raises the full model to 43.7 AP, 51.9 PQ and 47.2 mIoU at 6G, so the matching change adds accuracy without changing memory.

Architecture and training settings

The default pixel decoder is MSDeformAttn rather than FPN, with 6 MSDeformAttn layers over the 1/8, 1/16 and 1/32 feature maps and an upsampling step with a lateral connection that produces the 1/4 per-pixel embedding. The Transformer decoder uses L = 3, which gives 9 layers, and 100 queries by default, with auxiliary losses on each intermediate layer and on the learnable query features.

The mask loss combines binary cross-entropy and dice losses, each with weight 5.0, and the classification loss has weight 2.0 for predictions matched to a ground truth and 0.1 for unmatched predictions.

Panoptic and instance training uses AdamW with an initial learning rate of 0.0001, weight decay of 0.05 and a backbone learning rate multiplier of 0.1, with 50 epochs and batch size 16 by default. Large-scale jittering samples scales from 0.1 to 2.0 and crops to 1024x1024, and inference resizes the shorter side to 800 with the longer side capped at 1333.

Semantic segmentation models follow the MaskFormer settings, except that the 0.1 learning rate multiplier applies to both CNN and Transformer backbones.

FLOPs are averaged over 100 validation images, and fps is measured on a V100 GPU with batch size 1, including post-processing.

Panoptic segmentation on COCO

Table 1 compares panoptic models on COCO val2017 with 133 categories. With a ResNet-50 backbone, Mask2Former reaches 51.9 PQ in 50 epochs, against 46.5 PQ for MaskFormer trained for 300 epochs. The authors report that Mask2Former converges 6 times faster than MaskFormer.

With Swin-L and 200 queries, Mask2Former reaches 57.8 PQ, 5.1 above MaskFormer and 3.2 above K-Net. The K-Net row is listed with 36 epochs and the MaskFormer row with 300, so the training budgets differ across the compared rows.

The R50 Mask2Former row uses 226G FLOPs at 8.6 fps, against 181G FLOPs at 17.6 fps for MaskFormer, so the accuracy gain comes with more inference compute.

For the Swin-L model, the thing-category AP reaches 48.6 and the mIoU computed from panoptic annotations reaches 67.4, against 40.1 and 64.8 for MaskFormer. These two numbers come from the same panoptic-trained model and show that it also yields instance and semantic outputs.

Instance segmentation on COCO

With ResNet-50 and 50 epochs, Mask2Former reaches 43.7 AP, above the 42.5 AP of a Mask R-CNN baseline trained with large-scale jittering for 400 epochs. Its AP_S of 23.4 is below that baseline's 23.8, while its AP_L of 64.8 is above the baseline's 60.0. The authors describe the training as using 8 times fewer iterations than that baseline.

With Swin-L, Mask2Former reaches 50.1 AP against 49.5 AP for Swin-HTC++, which was trained for 72 epochs.

This comparison uses single-scale inference and models trained only on COCO train2017 data.

Semantic segmentation on ADE20K

Table 3 reports ADE20K val with 150 categories. With ResNet-50 at crop size 512, Mask2Former reaches 47.2 mIoU single-scale, against 44.5 for MaskFormer, and with Swin-T it reaches 47.7 against 46.7.

With Swin-L, the default MSDeformAttn version reaches 56.1 single-scale and 57.3 multi-scale. Using FaPN as the pixel decoder raises the multi-scale result to 57.7 mIoU, which is above the 57.0 multi-scale mIoU of BEiT-UperNet in the same table.

Which components account for the gains

All ablations use a ResNet-50 backbone and cover instance, panoptic and semantic segmentation. Removing masked attention lowers AP from 43.7 to 37.8, PQ from 51.9 to 47.1 and mIoU from 47.2 to 45.5, which is the largest drop in the table.

Among the cross-attention variants, masked attention reaches 43.7 AP, 51.9 PQ and 47.2 mIoU, against 37.8, 47.1 and 45.5 for standard cross-attention. The SMCA variant reaches 37.9 AP, 47.2 PQ and 46.6 mIoU, and mask pooling reaches 43.1 AP, 51.5 PQ and 46.0 mIoU. Mask pooling is the operation K-Net uses in place of cross-attention.

Learnable queries as region proposals

Because learnable queries are supervised by the mask loss, their predictions can be read as mask proposals before they enter the decoder. The authors visualize mask predictions of four selected learnable queries and measure class-agnostic AR@100 on COCO val2017.

The learnable queries reach an AR@100 of 50.3, and the recall rises with depth to 56.8 at layer 3, 57.4 at layer 6 and 57.7 at layer 9. The proposals therefore score well before any decoder layer runs, and the decoder layers add recall on top of them.

Cityscapes and other datasets

On Cityscapes val, Table 6 lists Mask2Former with R50 at 62.1 PQ, with Swin-B at 66.1 PQ and with Swin-L at 66.6 PQ. For Swin-L, the thing-category AP is 43.6 and the panoptic-derived mIoU is 82.9, while single-scale semantic mIoU is 83.3.

The table also lists specialized models such as Panoptic-DeepLab, SETR and SegFormer, and those values come from their own setups and backbones, so they are not a controlled comparison with this table. Results on ADE20K and Mapillary Vistas appear in an appendix that is not part of this excerpt.

Limits of task-specific training and small objects

The authors state that Mask2Former still needs to be trained for each specific task, and a single model trained once for multiple tasks and datasets is left for future work. Mask2Former struggles with small objects, with AP_S of 23.4 for ResNet-50, and it does not fully use the multi-scale features.

Paper info

Authors
Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar
Venue
arXiv · Preprint
First published
2021-12-2
Added
2026-11-12
Updated
2022-6-15
Version
v3
arXiv
2112.01527
Category
cs.CV · cs.AI · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar (2021). Masked-attention Mask Transformer for Universal Image Segmentation. arXiv:2112.01527v3. https://arxiv.org/abs/2112.01527v3

BibTeX
@misc{cheng2021masked,
  title = {{Masked-attention Mask Transformer for Universal Image Segmentation}},
  author = {Bowen Cheng and Ishan Misra and Alexander G. Schwing and Alexander Kirillov and Rohit Girdhar},
  year = {2021},
  eprint = {2112.01527},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.01527v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up