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.

Transfiner masks on a rider, a horse and a dog in a field
Labels
  • Bitmap masks
Apps
Serve
Source
Paper, GitHub

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:

BackboneCOCO mask APWeights
R50-FPN39.2203 MB
R50-FPN-DCN40.5206 MB
R101-FPN40.5276 MB
R101-FPN-DCN42.2281 MB
Swin-T43.5216 MB
Swin-B45.5465 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

  1. Start Serve Transfiner from the Ecosystem. A GPU is preferred, and the app also runs on a CPU.
  2. Open the app, select a checkpoint and press Serve.
  3. 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.

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.