Skip to content
ModelsThatRun

Mask2Former

Meta AI's masked-attention mask transformer for instance segmentation on COCO's 80 classes. Four Swin sizes; the weights are non-commercial (CC BY-NC 4.0).

Size

Non-commercial for size swin-tiny: code MIT, weights CC-BY-NC-4.0. Measured on our RTX 4090: 78.7 ms median, 5.5 GiB VRAM peak. We scored it 44.9 mask AP on COCO val2017. safetensors weights, 181 MB.

License

Non-commercial

Code
MITchecked 21 Nov 2026
Weights
CC-BY-NC-4.0all sizes, checked 21 Nov 2026

The code is MIT, but every model in the authors' model zoo is CC BY-NC 4.0. The Hugging Face card only says "other".

On our RTX 4090, measured

78.7ms median

p90 81.2 ms, fp32, batch 1, 1216x800

VRAM peak
5.5 GiB
Status
Runs as is
Environment, 22 Nov 2026

NVIDIA GeForce RTX 4090, driver 580.173.02, CUDA 13.0, torch 2.14.1+cu130, Python 3.12.9, transformers==5.20.2. Baseline 1065 MiB. 10 warm-up + 100 timed. Scope: predict(): pre-processing, forward pass and post-processing; input file decoded beforehand.

Accuracy

44.9mask APmeasured

COCO val2017, mask AP, 5,000 images, fp32, pycocotools==2.0.11 · 21 Nov 2026

Paper 45 COCO mask APMODEL_ZOO.md, COCO instance segmentation table (Swin-T)

Weights

safetensors

Size
181 MB
sha256
3550e8b21381d082c4d12b06a4b7c5f0f4a530125eee4c5f264b1e5f43dfab80
Download swin-tiny weights

Same photos and one score threshold for every model of this task. Failures are marked.

Use it when

You do non-commercial research and want the well-known baseline as published: our mask AP was within 0.3 of the repository's model zoo at all four sizes.

Avoid it when

You need commercial use (the weights are CC BY-NC 4.0) or speed: Swin-L took 137 ms a call for 49.9 mask AP, while GTR-Seg x, under a commercial license, scored 49.7 in 37 ms.

Sizes

SizeLatencyVRAMAccuracyWeightsRunsLicense
swin-tiny78.7 ms1216x8005.5 GiB44.9 mask AP, measured45 COCO mask AP paper181 MBAs isNon-commercial
swin-small86.3 ms1216x8005.6 GiB46.3 mask AP, measured46.3 COCO mask AP paper263 MBAs isNon-commercial
swin-base-in21k103 ms1216x8005.9 GiB48.1 mask AP, measured48.1 COCO mask AP paper412 MBAs isNon-commercial
swin-large137 ms1216x8006.4 GiB49.9 mask AP, measured50.1 COCO mask AP paper826 MBAs isNon-commercial

Estimated on other GPUs

Estimate, not measured. Worked out from our RTX 4090 run and NVIDIA's spec sheets. Each kind of GPU work is scaled by that GPU's peak for it: tensor cores at the precision the kernels used, CUDA cores, or memory bandwidth. The CPU's part of each call is kept at what it took on our Intel Core i7-10700K. How we estimate

Where a call's time goes on our RTX 4090: memory-bound 47%, CUDA cores, FP32 26%, CPU and kernel launches 22%, host–device copies 3%, tensor cores, TF32 2%.

GeForce (13)
GPUFitsLatency
GeForce RTX 5090Blackwell, 32 GB GDDR7Yes≈ 58–59 ms
GeForce RTX 5080Blackwell, 16 GB GDDR7Yes≈ 90–91 ms
GeForce RTX 5070 TiBlackwell, 16 GB GDDR7Yes≈ 100 ms
GeForce RTX 5070Blackwell, 12 GB GDDR7Yes≈ 130 ms
GeForce RTX 5060 Ti 16GBBlackwell, 16 GB GDDR7Yes≈ 170–180 ms
GeForce RTX 5060Blackwell, 8 GB GDDR7Yes≈ 190–200 ms
GeForce RTX 4080Ada Lovelace, 16 GB GDDR6XYes≈ 110 ms
GeForce RTX 4070 TiAda Lovelace, 12 GB GDDR6XYes≈ 140 ms
GeForce RTX 4070Ada Lovelace, 12 GB GDDR6XYes≈ 150–160 ms
GeForce RTX 3090Ampere, 24 GB GDDR6XYes≈ 110 ms
GeForce RTX 3080Ampere, 10 GB GDDR6XYes≈ 130 ms
GeForce RTX 3070 TiAmpere, 8 GB GDDR6XYes≈ 160–170 ms
GeForce RTX 3070Ampere, 8 GB GDDR6Yes≈ 190 ms
Workstation (4)
GPUFitsLatency
RTX PRO 6000 Blackwell Workstation EditionBlackwell, 96 GB GDDR7Yes≈ 54–56 ms
RTX PRO 6000 Blackwell Max-Q Workstation EditionBlackwell, 96 GB GDDR7Yes≈ 56–58 ms
RTX 6000 Ada GenerationAda Lovelace, 48 GB GDDR6Yes≈ 78 ms
RTX A6000Ampere, 48 GB GDDR6Yes≈ 110 ms
Data center (6)
GPUFitsLatency
B200 (HGX, one GPU)Blackwell, 180 GB HBM3EYes≈ 47–49 ms
H200 SXMHopper, 141 GB HBM3eYes≈ 53–55 ms
H100 SXMHopper, 80 GB HBM3Yes≈ 56–58 ms
A100 SXM 80GBAmpere, 80 GB HBM2eYes≈ 120–130 ms
L40SAda Lovelace, 48 GB GDDR6Yes≈ 82 ms
L4Ada Lovelace, 24 GB GDDR6Yes≈ 190–200 ms

CPU only

Measured by us with no GPU on an Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 8 cores, 94.2 GiB of memory: the same official code with the GPU hidden, in fp32 on 8 threads. Before it was timed, its output on the timing input was checked against the GPU's. These numbers say what to expect without a GPU. They aren't compared with any GPU's, here or in the charts. How we measure on a CPU

SizeRuntimeLatency on the CPURAM peak
swin-tinyPyTorch2.14.1 · fp32 · 8 threads3888 ms1216x8004.5 GiB
swin-smallPyTorch2.14.1 · fp32 · 8 threads4435 ms1216x8004.5 GiB
swin-base-in21kPyTorch2.14.1 · fp32 · 8 threads5411 ms1216x8004.7 GiB
swin-largePyTorch2.14.1 · fp32 · 8 threads7510 ms1216x8005.2 GiB

From the authors

In their words, with their numbers. Ours are in the cards at the top of this page.

Paper

Masked-attention Mask Transformer for Universal Image Segmentation

Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar

arXiv 2112.01527, 2 Dec 2021

Abstract

Image segmentation is about grouping pixels with different semantics, e.g., category or instance membership, where each choice of semantics defines a task. While only the semantics of each task differ, current research focuses on designing specialized architectures for each task. We present Masked-attention Mask Transformer (Mask2Former), a new architecture capable of addressing any image segmentation task (panoptic, instance or semantic). Its key components include masked attention, which extracts localized features by constraining cross-attention within predicted mask regions. In addition to reducing the research effort by at least three times, it outperforms the best specialized architectures by a significant margin on four popular datasets. Most notably, Mask2Former sets a new state-of-the-art for panoptic segmentation (57.8 PQ on COCO), instance segmentation (50.1 AP on COCO) and semantic segmentation (57.7 mIoU on ADE20K).

README

Copied from the authors' repository at commit 9b0651c on 23 Nov 2026. Numbers and license claims in it are theirs, not measured or checked by us. We removed badges, replaced images with links and adjusted headings.

Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar

[arXiv] [Project] [BibTeX]

Figure maskformerv2 teaser

Features

  • A single architecture for panoptic, instance and semantic segmentation.
  • Support major segmentation datasets: ADE20K, Cityscapes, COCO, Mapillary Vistas.

Updates

  • Add Google Colab demo.
  • Video instance segmentation is now supported! Please check our tech report for more details.

Installation

See installation instructions.

Getting Started

See Preparing Datasets for Mask2Former.

See Getting Started with Mask2Former.

Run our demo using Colab:

Integrated into Huggingface Spaces 🤗 using Gradio. Try out the Web Demo:

Replicate web demo and docker image is available here:

Advanced usage

See Advanced Usage of Mask2Former.

Model Zoo and Baselines

We provide a large set of baseline results and trained models available for download in the Mask2Former Model Zoo.

License

Shield:

The majority of Mask2Former is licensed under a MIT License.

However portions of the project are available under separate license terms: Swin-Transformer-Semantic-Segmentation is licensed under the MIT license, Deformable-DETR is licensed under the Apache-2.0 License.

Citing Mask2Former

If you use Mask2Former in your research or wish to refer to the baseline results published in the Model Zoo, please use the following BibTeX entry.

@inproceedings{cheng2021mask2former,
  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},
  journal={CVPR},
  year={2022}
}

If you find the code useful, please also consider the following BibTeX entry.

@inproceedings{cheng2021maskformer,
  title={Per-Pixel Classification is Not All You Need for Semantic Segmentation},
  author={Bowen Cheng and Alexander G. Schwing and Alexander Kirillov},
  journal={NeurIPS},
  year={2021}
}

Acknowledgement

Code is largely based on MaskFormer (https://github.com/facebookresearch/MaskFormer).

Alternatives

Changes

First published . Every model's changes

    • Added, with sizes swin-tiny, swin-small, swin-base-in21k, and swin-large

Badge for a README

It says the model ran on our RTX 4090 and links to this page. It carries no number, so it never goes out of date.

ModelsThatRun: ran on RTX 4090
[![ModelsThatRun: ran on RTX 4090](https://modelsthatrun.dev/models/mask2former/badge.svg)](https://modelsthatrun.dev/models/mask2former/)

Something wrong on this page, such as a license or a number? Email us.

⇆
InputOutput