Paper commentary
Mask R-CNN
- Problem Instance segmentation needs every object found and each one outlined at pixel level, but Faster R-CNN was built around box outputs and its RoI pooling loses pixel alignment.
- Method Adds a per-RoI mask branch in parallel with the class and box heads, predicts one sigmoid mask per class, and replaces RoIPool with the quantization-free RoIAlign.
- Results Reached 35.7 mask AP on COCO test-dev with a single ResNet-101-FPN model, against 33.6 for FCIS+++.
Why instance segmentation needs more than detection
Faster R-CNN classifies each candidate region and regresses its box, while FCN-style models label every pixel without separating one object from another. Instance segmentation asks for both: every object has to be found, and each one has to be outlined at pixel level. Faster R-CNN was never designed to keep network inputs and outputs in exact pixel correspondence, which is the gap this work targets.
The specific source of the mismatch is RoIPool, which snaps RoI coordinates and bin edges onto the feature grid before max pooling. Rounding a coordinate to the stride-16 grid shifts the sampled region, which costs little for classification but a lot for a mask that has to match object edges. The study therefore asks two questions: whether a parallel mask branch can be added to Faster R-CNN without losing speed, and whether aligned RoI features are needed to predict masks well.
How the mask branch is added to Faster R-CNN
Mask R-CNN keeps the two-stage layout of Faster R-CNN, with the Region Proposal Network producing candidate boxes first. For each RoI the second stage already predicts a class and a box offset, and Mask R-CNN adds a third output, a binary mask, computed in parallel with the other two. Training minimizes the sum \( L = L_{cls} + L_{box} + L_{mask} \), where the classification and box terms are the ones defined for Fast R-CNN.
For K classes the mask head outputs a \( K m^2 \) vector, which encodes K binary masks of resolution m×m, and a per-pixel sigmoid turns each value into a mask probability. The mask loss is the average binary cross-entropy, computed only on the mask of the ground-truth class k, so the other class masks receive no gradient for that RoI. Because the class prediction chooses which mask is read out, mask prediction and classification are decoupled, and masks of different classes do not compete through a softmax.
Each mask comes from a small fully convolutional network applied to the RoI features, so the m×m spatial layout is kept rather than flattened by fully connected layers. At inference the mask branch runs only on the highest scoring 100 detection boxes, and the mask of the predicted class is resized to the RoI size and binarized at 0.5. The authors estimate that this adds roughly 20% to the cost of a typical Faster R-CNN model.
Replacing quantized pooling with RoIAlign
RoIPool snaps the floating-point RoI to the feature grid, splits it into bins whose edges are snapped again, and then aggregates each bin, usually by max pooling. Each snap moves the region by a fraction of a stride, and these moves accumulate between the proposal and the pooled features.
RoIAlign removes the snapping: the coordinates are divided by the stride exactly, and four regularly spaced sample points lie in each bin. The value at each sample comes from bilinear interpolation of the nearby feature grid points, and the samples in a bin are combined by max or average. Results change little with the exact sample positions or their number, as long as no coordinate is quantized.
RoIWarp is the closest prior operation, since it also uses bilinear resampling but still quantizes the RoI as RoIPool does. Its results match RoIPool rather than RoIAlign, which the authors read as evidence that proper alignment is the key factor.
Backbones, heads and training settings
The backbone is a ResNet or ResNeXt network of depth 50 or 101 layers, and features are read either from the fourth stage, called C4, or from a Feature Pyramid Network built on the backbone. The C4 head includes the fifth stage of ResNet, which is compute-intensive, while the FPN backbone already contains that stage and so its head uses fewer filters.
The mask head is a fully convolutional stack with a deconvolution, producing a 28×28 mask for each of the 80 classes in the COCO setting.
Images are scaled to a shorter edge of 800 pixels, each GPU handles 2 images, and sampled RoIs use a 1:3 ratio of positive to negative examples. The number of sampled RoIs per image is 64 for the C4 backbone and 512 for FPN, and training runs for 160k iterations on 8 GPUs with a learning rate of 0.02 that is lowered by 10 at 120k iterations.
With ResNeXt the training uses one image per GPU and starts at a learning rate of 0.01.
At test time 300 proposals are used for the C4 backbone and 1000 for FPN, followed by non-maximum suppression. The RPN is trained separately and does not share features with Mask R-CNN in the ablations unless stated otherwise.
COCO instance segmentation against prior entries
On COCO test-dev, Mask R-CNN with ResNet-101-FPN reaches 35.7 mask AP as a single model, and the ResNeXt-101-FPN version reaches 37.1. In the same table MNC with ResNet-101-C4 reaches 24.6, FCIS with OHEM reaches 29.2 and FCIS+++ reaches 33.6. FCIS+++ adds multi-scale training and testing, horizontal flip testing and OHEM, so its number reflects a more heavily tested entry than the single Mask R-CNN run.
The authors state that this comparison covers the 2016 challenge winner as well.
A visual comparison with FCIS+++ on overlapping objects shows systematic artifacts in FCIS+++ and none in Mask R-CNN. These are qualitative examples on COCO test images and do not add a measured score.
What the ablations isolate
Backbone variants on ResNet-50-C4, ResNet-101-C4, ResNet-50-FPN, ResNet-101-FPN and ResNeXt-101-FPN reach 30.3, 32.7, 33.6, 35.4 and 36.7 mask AP. Deeper networks, FPN and ResNeXt each help, although the authors note that not every framework gains from deeper or more advanced networks.
The mask output is compared under a per-pixel sigmoid with per-class binary masks and under a per-pixel softmax with a multinomial loss, both on ResNet-50-C4. The softmax variant reaches 24.8 mask AP and the sigmoid variant 30.3, a 5.5-point difference. The authors read this as showing that once the box branch has classified an instance, a binary mask is sufficient and easier to train.
Predicting a single class-agnostic mask reaches 29.7 mask AP, compared with 30.3 for class-specific masks on ResNet-50-C4.
Average RoIAlign is used for the remaining experiments, and its gain over RoIPool is about 3 points, with most of it at the stricter IoU thresholds.
On ResNet-50-C5 with stride 32, RoIPool gives 23.6 mask AP and RoIAlign gives 30.9, a 7.3-point gain. Stride-32 features with RoIAlign are more accurate than the stride-16 C4 features with RoIAlign, at 30.9 against 30.3. The authors say RoIAlign largely resolves the difficulty of using large-stride features.
On ResNet-50-FPN, an fc-based mask head with one hidden layer reaches 31.5 mask AP and the fully convolutional head reaches 33.6. The fully convolutional head is 2.1 points higher, and its convolutional layers are not pre-trained, so the comparison with the fc head is fair.
Box detection and running time
In the box-only evaluation the mask output is ignored, and Mask R-CNN with ResNet-101-FPN reaches 38.2 box AP on test-dev. With ResNeXt-101-FPN it reaches 39.8 box AP, against 36.8 for the Inception-ResNet-v2-TDM single-model entry. The ResNeXt model is 3.0 points above that entry in box AP.
Faster R-CNN with RoIAlign and without a mask branch reaches 37.3 box AP, which is 0.9 below Mask R-CNN. The authors attribute that 0.9-point difference to multi-task training. Mask AP of 37.1 and box AP of 39.8 differ by 2.7 points, which the authors read as a small mask-to-box gap.
The ResNet-101-C4 variant takes about 400ms because its box head is heavier. Training ResNet-50-FPN on COCO trainval35k takes 32 hours on the synchronized 8-GPU implementation at 0.72s per 16-image mini-batch, and ResNet-101-FPN takes 44 hours.
Person keypoint detection
Each of the K keypoint types is turned into a one-hot m×m mask with a single foreground pixel, so Mask R-CNN predicts K masks for a person. For each visible ground-truth keypoint the loss is a cross-entropy over an m²-way softmax, and the K keypoints are still treated independently.
The keypoint head uses a stack of eight 3×3 512-d convolutions, a deconvolution and 2× bilinear upscaling, which gives a 56×56 output. Training uses COCO trainval35k images that contain keypoints, with image scales sampled from 640 to 800 pixels for 90k iterations, a learning rate of 0.02 lowered at 60k and 80k iterations, and inference at a single scale of 800 pixels.
The keypoint-only model reaches 62.7 keypoint AP on COCO test-dev, which is 0.9 above CMU-Pose+++ at 61.8. CMU-Pose+++ is the 2016 winner and uses multi-scale testing, post-processing with CPM and filtering with an object detector, which the authors say adds about 5 points. Adding the segment branch for the person category raises keypoint AP to 63.1 on test-dev.
On minival with ResNet-50-FPN, adding the mask branch to the keypoint-only model raises box AP from 50.7 to 52.0 and keypoint AP from 64.2 to 64.7. Adding the keypoint branch to the mask-only model lowers box AP from 53.6 to 52.0 and mask AP from 45.8 to 45.1. The authors conclude that keypoint detection benefits from multi-task training while it does not help the box and mask tasks in turn.
On minival, RoIAlign raises keypoint AP from 59.8 with RoIPool to 64.2, a 4.4-point gain. The authors attribute the gain to keypoint detection being more sensitive to localization accuracy, even with the finer strides of the FPN backbone.
Cityscapes instance segmentation
The Cityscapes instance task has 8 categories, with fine annotations for 2975 train, 500 val and 1525 test images, and the 20k coarse images are not used. Models use a ResNet-FPN-50 backbone with the shorter side sampled from 800 to 1024 pixels and inference at 1024 pixels. Training runs 24k iterations at a batch of 8 images on 8 GPUs, with a learning rate of 0.01 reduced to 0.001 at 18k iterations.
The fine-only model reaches 26.2 AP on test, which the authors describe as more than 30% relative above DIN at 20.0 AP, a method that uses fine and coarse data. The best fine-only entry in the table is SAIS at 17.4 AP, and the gain over it is about 50%. SGN reaches 25.0 with fine and coarse data.
The person and car categories contain many overlapping instances, about 6 people and 9 cars per image on average. Person AP rises from 21.8 to 30.5 and car AP from 39.4 to 46.9 over the other best entries.
Truck, bus and train have about 200 to 500 training samples each, which makes low-data training the main challenge on this dataset. The COCO pre-trained model initializes the 7 corresponding categories, leaves rider randomly initialized, and is fine-tuned for 4k iterations with the learning rate lowered at 3k, which takes about one hour. This reaches 32.0 AP on test, almost 6 points above the fine-only model.
With fine-only training, the truck, bus and train categories have val/test AP of 28.8/22.8, 53.5/32.2 and 33.0/18.6. COCO pre-training raises these to 38.0/30.1, 57.5/40.9 and 41.2/30.9, but the val-test gap remains. Person and car show no such bias, with val and test AP within 1 point of each other.
Enhanced COCO results in the appendix
Appendix B stacks known improvements on the original Mask R-CNN and reports minival results after each step. Mask AP rises from 36.7 to 41.8 and box AP from 39.6 to 47.3 across the table. The authors note that the three winning teams of the COCO 2017 instance segmentation competition used Mask R-CNN as their framework.
The updated baseline lengthens training to 180k iterations and raises the NMS threshold to 0.5 from 0.3, giving 37.0 mask AP and 40.5 box AP. End-to-end training, which uses the approximate version that ignores the gradient with respect to RoI coordinates, adds 0.6 mask AP and 1.2 box AP. ImageNet-5k pre-training uses a 5k-class subset, a 5× increase in pre-training data, and improves both mask and box AP.
Moving to a 152-layer ResNeXt adds 0.5 mask AP and 0.6 box AP, and the non-local model reaches 40.3 mask AP and 45.0 box AP without test-time augmentation. Test-time augmentation over scales of 400 to 1200 pixels with horizontal flips gives 41.8 mask AP and 47.3 box AP.
For keypoints, a longer schedule of 130k iterations adds about 1 point, and ResNet-101 and ResNeXt-101 reach 66.1 and 67.3 keypoint AP on minival. Data distillation, which uses the additional 120k unlabeled COCO images through self-training, raises keypoint AP to 69.1, and test-time augmentation brings it to 70.4.
Limits of the reported evidence
The authors state that the design is not optimized for speed and that better speed and accuracy trade-offs could be reached by varying image sizes and proposal numbers. Those trade-offs are beyond the scope of the paper, so they are not measured. The mask branch is deliberately simple, and more complex designs could improve performance but are not studied.
Cityscapes results use ResNet-50-FPN, and the 101-layer counterpart is reported only as performing similarly. The truck, bus and train domain shift persists even with COCO pre-training. The keypoint results rely on minimal domain knowledge, and the authors expect that structural modeling would be complementary.
The comparison with FCIS+++ on overlapping objects is shown only on example images, not as a measured metric. The ablations are run on minival with the RPN trained separately, so their settings differ from the test-dev entries in the main comparison.
Paper info
- Authors
- Kaiming He, Georgia Gkioxari, Piotr Dollár, Ross Girshick
- Venue
- arXiv · Preprint
- First published
- 2017-3-20
- Added
- 2026-10-20
- Updated
- 2018-1-24
- Version
- v3
- arXiv
- 1703.06870
- Category
- cs.CV
- 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
Kaiming He, Georgia Gkioxari, Piotr Dollár, Ross Girshick (2017). Mask R-CNN. arXiv:1703.06870v3. https://arxiv.org/abs/1703.06870v3
BibTeX
@misc{he2017mask,
title = {{Mask R-CNN}},
author = {Kaiming He and Georgia Gkioxari and Piotr Dollár and Ross Girshick},
year = {2017},
eprint = {1703.06870},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1703.06870v3}
}