Mask R-CNN

The paper extends Faster R-CNN with a parallel mask prediction branch and a better feature alignment operator for instance segmentation.

Metadata

FieldValue
PaperMask R-CNN
AuthorsKaiming He, Georgia Gkioxari, Piotr Dollár, Ross Girshick
Year2017
VenueICCV 2017
arXiv1703.06870
Statusseed note started

One-Line Takeaway

Mask R-CNN keeps the two-stage detection structure of Faster R-CNN and adds an instance-specific dense mask head, making detection, box regression, and mask prediction share one region-based architecture.

Question

Object detection predicts boxes:

Instance segmentation predicts boxes plus a separate mask for each object:

where:

  • is the class;
  • is the bounding box;
  • is the instance mask;
  • is the confidence score.

The paper asks:

Can a strong two-stage detector be extended to pixel-level instance masks without making the architecture complicated?

Architecture Contract

ComponentRole
CNN backboneextracts image features
Region Proposal Networkproposes object-like regions
RoIAlignextracts spatially aligned region features
classification headpredicts object category
box headrefines bounding box coordinates
mask headpredicts a class-specific binary mask for each RoI

The architectural change from Faster R-CNN:

RoIAlign

Faster R-CNN uses RoI pooling to convert variable-sized regions into fixed-size tensors. Quantization in this step can misalign features and pixels, which hurts mask quality.

Mask R-CNN replaces it with RoIAlign:

where is the feature map and is a proposed region.

Conceptually:

  1. avoid rounding region coordinates to coarse feature bins;
  2. sample feature values at fractional coordinates;
  3. use bilinear interpolation;
  4. preserve spatial alignment for the mask head.

For a fractional coordinate , bilinear interpolation can be written as:

where neighboring grid points contribute according to interpolation weights .

This is a small architectural operator, but it matters because masks are evaluated at pixel-level boundaries.

Mask Head

For each region feature , Mask R-CNN predicts:

where is the number of classes.

The selected mask is usually the channel corresponding to the predicted class:

The mask branch is fully convolutional, so it preserves spatial structure inside the RoI:

Multi-Task Objective

Mask R-CNN uses the Faster R-CNN detection losses plus a mask loss:

For the target class , the mask loss is binary cross entropy over the mask grid:

This keeps mask prediction class-specific while avoiding competition between classes at every pixel.

Why It Matters

Mask R-CNN is a canonical example of extending an architecture by adding a task head while preserving the core representation pipeline:

The important lesson is not only that masks improve segmentation. It is that a clean architecture can support several structured outputs if the intermediate representation has the right granularity.

Relation To Later Models

Model familyObject representationOutput style
Faster R-CNNproposed RoIsclass and box
Mask R-CNNproposed RoIsclass, box, and mask
DETRlearned object queriesclass and box set
modern segmentersprompts, masks, or query slotsdense masks or mask sets

Mask R-CNN is still useful to read before modern promptable segmentation systems because it makes the difference between detection boxes, aligned RoI features, and per-instance masks explicit.

What To Watch

  • Mask quality depends heavily on feature alignment.
  • The model inherits two-stage detector dependencies: proposals, anchor choices, and NMS.
  • The mask head predicts masks per region, not a single global semantic map.
  • Box AP and mask AP can move differently; one does not fully explain the other.
  • The method is architecture-general: stronger backbones and feature pyramids can be plugged in.