Mask Transfiner draws instance masks with fine detail
Mask Transfiner is an instance segmentation model that refines the error-prone parts of each mask, mostly along object boundaries, with a transformer over a quadtree. In Supervisely you serve its COCO-pretrained checkpoints to pre-label people, animals, vehicles and the other COCO classes with detailed masks, in images and videos.

- Labels
- Bitmap masks
- Apps
- Serve
Apps in the Supervisely Ecosystem
Every model in Supervisely comes as a Supervisely App: a module from the Ecosystem that plugs into the platform and runs on your own GPU, with no code to install. A Serve App puts the model behind the labeling tools, and where the model can be trained, a Train App fits it to your labeled project. All Apps work on the same projects, so you add a model, update it or swap it for another without changing anything else.
Fixing the pixels that decide mask quality
"Mask Transfiner for High-Quality Instance Segmentation" by Lei Ke, Martin Danelljan, Xia Li, Yu-Wing Tai, Chi-Keung Tang and Fisher Yu appeared at CVPR 2022 (code). It starts from an observation: two-stage and query-based instance segmentation methods find objects well, but their masks stay coarse.
Instead of refining a dense grid, Mask Transfiner splits the image regions into a quadtree, detects the tree nodes that are likely wrong and lets a transformer correct only those, in parallel. These pixels are a small share of the image, mostly along boundaries, yet they decide how good a mask looks, so the extra computation stays small. The authors report gains of 3.0 mask AP on COCO and BDD100K and 6.6 boundary AP on Cityscapes over the frameworks it improves. The official code is built on detectron2.
Six COCO checkpoints
Serve Transfiner offers six checkpoints trained on COCO, all predicting the 80 COCO classes:
| Backbone | COCO mask AP | Weights |
|---|---|---|
| R50-FPN | 39.2 | 203 MB |
| R50-FPN-DCN | 40.5 | 206 MB |
| R101-FPN | 40.5 | 276 MB |
| R101-FPN-DCN | 42.2 | 281 MB |
| Swin-T | 43.5 | 216 MB |
| Swin-B | 45.5 | 465 MB |
The ResNet figures are on COCO test-dev and the Swin figures on COCO val2017, as the official repository reports them; DCN marks deformable convolutions. The Swin-B checkpoint, whose backbone was pretrained on ImageNet-22k, scores highest of the six and is also the largest.
Serving and pre-labeling
- Start Serve Transfiner from the Ecosystem. A GPU is preferred, and the app also runs on a CPU.
- Open the app, select a checkpoint and press Serve.
- Use the running model from another app.
It returns a bitmap mask with a confidence for each object, keeping those above the threshold (0.45 by default). Apply NN to Images Project pre-labels a whole project, Apply NN to Videos Project labels videos, and NN Image Labeling adds masks to the image open in the image labeling toolbox. Outside the platform, the Inference Session API calls the same model from code.
Limits and other options
The app serves only the six COCO checkpoints: there is no training app, and it does not load custom models, so it finds COCO classes such as person, car or dog and nothing else. Treat its masks as model-assisted labeling: a draft that people review and fix.
- For masks of your own classes, train SparseInst, Detectron2, Ultralytics YOLO or MMDetection.
- For a mask of any object from a click or a box, use Segment Anything 2.1.
- For one class per pixel rather than separate objects, see semantic segmentation.
Frequently asked questions.
Can I train Transfiner on my own classes in Supervisely?
No. Serve Transfiner deploys six checkpoints pretrained on COCO and does not load custom models. To segment your own classes, train SparseInst, Detectron2 or YOLO instead.
How does Mask Transfiner compare with Mask R-CNN?
Mask Transfiner refines the error-prone pixels of the masks a two-stage detector produces. On COCO test-dev, the official repository lists 37.0 mask AP for Transfiner with a 1x schedule against 34.2 for Mask R-CNN, both with a ResNet-50-FPN backbone.
Does Serve Transfiner need a GPU?
A GPU is preferred, but the app also runs on a CPU.
Train and serve models on your own data.
Label a project in a free account, train a model on it from the browser and deploy it on your own GPU. Or book a demo to run Supervisely on your servers.



