← AI Terminology

Mask R-CNN

Mask R-CNN is a two-stage instance segmentation model that extends Faster R-CNN with a parallel mask prediction branch — producing a pixel-level binary mask for each detected object instance in addition to bounding boxes and class labels.

Introduced by He et al. (Facebook AI Research) in 2017; still a foundational reference architecture.
Why It Matters in AI
Mask R-CNN was the first model to cleanly unify object detection (bounding boxes) and pixel-level segmentation in a single, trainable end-to-end architecture. It introduced RoIAlign — a key fix to the spatial misalignment problem in RoIPool — and showed that adding a small mask head to a detection backbone was enough to achieve state-of-the-art instance segmentation. It remains the pedagogical standard and a baseline against which all subsequent segmentation models are measured.
Key Points
Aspect Description
RoIAlign Bilinear interpolation instead of quantised RoIPool — fixes spatial misalignment for pixel tasks
Mask head Small FCN applied per RoI — predicts a 28×28 binary mask per class
Detectron2 Facebook's production framework — detectron2.projects.MaskRCNN, pretrained on COCO
Limitations Two-stage → slower than one-stage models (YOLO, SOLOv2) — superseded for real-time applications
Architecture Backbone (ResNet+FPN) → Region Proposal Network → RoIAlign → parallel heads: class, box, mask
Training loss Multi-task: classification loss + bounding box regression loss + binary mask BCE loss
Simple Analogy
A two-pass factory inspection: the first pass (RPN) flags which regions of an image likely contain objects; the second pass (RoIAlign + heads) examines each flagged region carefully and produces three outputs simultaneously — "what is it", "where exactly is it", and "which pixels belong to it".
Common Usage Examples
  • detectron2: cfg.MODEL.ROI_HEADS.NAME = "StandardROIHeads" — standard Mask R-CNN config
  • COCO pretrained weights: model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x")
  • Medical imaging: segment individual cells/tumours with Mask R-CNN fine-tuned on pathology slides
  • from torchvision.models.detection import maskrcnn_resnet50_fpn — PyTorch built-in implementation
  • COCO benchmark: Mask R-CNN R50-FPN achieves ~37 mask AP — standard comparison point
Summary
In short: Mask R-CNN unified object detection and pixel-level instance segmentation in a single architecture — the foundational instance segmentation model that introduced RoIAlign and set the benchmark every subsequent model is measured against.