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
| Field | Value |
|---|---|
| Paper | Mask R-CNN |
| Authors | Kaiming He, Georgia Gkioxari, Piotr Dollár, Ross Girshick |
| Year | 2017 |
| Venue | ICCV 2017 |
| arXiv | 1703.06870 |
| Status | seed 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
| Component | Role |
|---|---|
| CNN backbone | extracts image features |
| Region Proposal Network | proposes object-like regions |
| RoIAlign | extracts spatially aligned region features |
| classification head | predicts object category |
| box head | refines bounding box coordinates |
| mask head | predicts 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:
- avoid rounding region coordinates to coarse feature bins;
- sample feature values at fractional coordinates;
- use bilinear interpolation;
- 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 family | Object representation | Output style |
|---|---|---|
| Faster R-CNN | proposed RoIs | class and box |
| Mask R-CNN | proposed RoIs | class, box, and mask |
| DETR | learned object queries | class and box set |
| modern segmenters | prompts, masks, or query slots | dense 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.