Mask Scoring R-CNN

Zhaojin Huang, Lichao Huang, Yongchao Gong, Chang Huang, Xinggang Wang

Abstract

Instance segmentation requires both accurate object localization and precise pixel-level masking. While state-of-the-art models like Mask R-CNN excel at these tasks, they often fail to accurately rank their predictions because they rely on classification confidence as a proxy for mask quality. We present Mask Scoring R-CNN (MS R-CNN), which incorporates a dedicated MaskIoU head to predict the alignment between a predicted mask and the ground truth. This simple addition allows for better ranking of results, leading to a consistent improvement in Average Precision (AP) across various backbones.

Introduction

In the task of instance segmentation, models must identify individual objects and generate a binary mask for each. The standard evaluation metric, Average Precision (AP), relies heavily on the ranking of these predictions. Traditionally, frameworks like Mask R-CNN use the classification score—the probability that a bounding box belongs to a certain category—to rank the quality of the associated mask. However, classification confidence does not necessarily correlate with the spatial integrity of the mask.

The Misalignment Problem

The fundamental issue addressed by this work is the misalignment between classification scores and mask quality. A model may be highly confident in an object's category (e.g., 0.99 for "person") while producing a fragmented or incomplete mask. Conversely, a lower-confidence detection might yield a near-perfect mask. When the classification score is used for ranking, these high-quality but lower-confidence masks are penalized, degrading the overall AP.

Qualitative comparison between MS R-CNN and Mask R-CNN. MS R-CNN provides scores that better reflect the actual mask quality (IoU), whereas Mask R-CNN often assigns high scores to poor masks.

Methodology: Mask Scoring R-CNN

To resolve this, we propose Mask Scoring R-CNN. This architecture extends Mask R-CNN by adding a MaskIoU head.

The MaskIoU Head

The MaskIoU head is designed to regress the Intersection over Union (IoU) between the predicted mask and the ground truth. It takes the RoI features and the predicted mask as input, allowing the network to evaluate its own spatial output against the underlying image features.

Calibrated Scoring

During inference, the final score for a mask ($S_{mask}$) is no longer just the classification score ($S_{cls}$). Instead, it is the product of the classification score and the predicted MaskIoU ($S_{iou}$):

$$S_{mask} = S_{cls} \times S_{iou}$$

This multiplication ensures that the final ranking reflects both the semantic certainty and the spatial accuracy of the prediction.

Experimental Evaluation

We evaluated MS R-CNN on the COCO 2017 dataset using various ResNet backbones.

Quantitative Results

The addition of the MaskIoU head consistently improved performance by approximately 1.5% AP across ResNet-18, ResNet-50, and ResNet-101 architectures. On the COCO test-dev set, MS R-CNN achieved 39.6% AP, outperforming the baseline Mask R-CNN and other contemporary models.

Improved Correlation

A key metric for the success of this approach is the correlation between the predicted score and the actual mask quality. In standard Mask R-CNN, this correlation is weak. With the MaskIoU head, the correlation coefficient increases significantly (reaching 0.74), demonstrating that the model has become "self-aware" of its mask quality.

Correlation between the predicted score and actual MaskIoU for MS R-CNN. The tighter distribution indicates that the predicted scores are much better aligned with actual mask quality compared to baseline methods.

Conclusion

Mask Scoring R-CNN addresses a critical oversight in instance segmentation frameworks: the lack of a reliable metric for mask quality during ranking. By introducing a lightweight MaskIoU head, we enable the model to calibrate its own scores, leading to more accurate rankings and superior performance on standard benchmarks. This approach is modular and can be easily integrated into other R-CNN-based detection systems.

Summary updated

BibTeX
@inproceedings{huang2019mask,
  author = {Zhaojin Huang and Lichao Huang and Yongchao Gong and Chang Huang and Xinggang Wang},
  title = {{Mask Scoring R-CNN}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00657},
}
Figure