Mask R-CNN
5 memberslucid.models.vision.mask_rcnnMask R-CNN — instance segmentation (He et al., ICCV 2017).
Paper: "Mask R-CNN"
ResNet-50-FPN reference configuration (Faster R-CNN backbone + parallel mask branch) with a COCO-pretrained checkpoint.
He, Kaiming, et al. "Mask R-CNN." Proceedings of the IEEE International Conference on Computer Vision, 2017, pp. 2961–2969.
Mask R-CNN extends Faster R-CNN with a parallel mask branch that predicts a per-RoI binary segmentation, turning the two-stage detector into a unified instance-segmentation model with negligible runtime overhead.
Three design changes are critical:
- Feature Pyramid Network backbone. Lateral convolutions fuse top-down semantically strong features with bottom-up spatially precise ones, yielding multi-scale outputs all at the same channel depth (256). Each RoI is routed to the level
so small objects use high-resolution maps and large ones use deeper, semantically richer features.
-
RoI Align. RoI Pool quantises coordinates twice (proposal → feature grid, then feature grid → output cells), which misaligns mask predictions by several pixels. RoI Align removes both quantisations and bilinearly interpolates four regularly-sampled points per cell. This single change adds AP on the mask task.
-
Decoupled mask head. Unlike FCN-style approaches that compete classes via per-pixel softmax, Mask R-CNN emits a tensor of per-class binary masks and applies sigmoid + binary cross-entropy. The classification branch alone chooses which class's mask to use at inference, avoiding inter-class competition during training.
The total loss is a sum of the Faster R-CNN classification + regression terms and an additional mean BCE on the predicted mask channel of the ground-truth class, .