How does Mask R-CNN do instance segmentation?
understanding of two-stage detectors and per-instance masks.
Faster R-CNN backbone plus RPN, then RoIAlign and a parallel mask head predicting per-class binary masks.
claiming masks are shared or that RoIPool is used.
WHAT THIS TESTS Whether you understand how a detection framework is extended to produce per-instance pixel masks, and why small architectural choices like RoIAlign matter.
A GOOD ANSWER COVERS Mask R-CNN builds directly on Faster R-CNN. A convolutional backbone, often a ResNet with a Feature Pyramid Network, extracts features. A Region Proposal Network proposes candidate object regions. For each proposal, features are extracted and fed to two existing heads that predict the class and refine the bounding box. Mask R-CNN adds a third head, a small fully convolutional network, that outputs a binary mask for each RoI. Crucially, masks are predicted per class without competition between classes; the classification head selects which mask to use. RoIPool is replaced by RoIAlign, which uses bilinear interpolation instead of harsh quantization, preserving spatial alignment that pixel-accurate masks need.
COMMON WRONG ANSWERS Saying the mask branch uses a softmax across classes per pixel, which couples classification and segmentation unnecessarily. Forgetting RoIAlign and claiming RoIPool is fine, when its rounding introduces misalignment that degrades masks. Describing it as a single-stage detector or confusing it with semantic segmentation that ignores instances.
LIKELY FOLLOW-UPS Why does decoupling mask and class prediction help? How does RoIAlign differ numerically from RoIPool? How is the multi-task loss combining classification, box regression, and mask terms balanced? How does it handle overlapping instances?
ONE CONCRETE EXAMPLE For an image with two overlapping people, the RPN proposes regions around each. RoIAlign crops aligned features per region. The mask head outputs, say, a 28 by 28 mask per class for each RoI; the class head says person, so the person-channel mask is upsampled back to image coordinates, yielding two distinct instance masks even where the people overlap.
Interview question
Why does Mask R-CNN replace RoIPool with RoIAlign in its pipeline?
- a.To reduce the number of region proposals from the RPN
- b.To let the mask branch share weights with the class branch
- c.To avoid quantization that misaligns features with mask pixelsCorrect
- d.To convert the detector from two-stage to single-stage
Why? this is the answer
RoIAlign uses bilinear interpolation instead of rounding coordinates, preserving spatial alignment that pixel-accurate masks require. RoIPool's quantization is fine for boxes but introduces misalignment that visibly degrades masks.
Just read this? Test yourself on what you have been reading.
Read the original → arxiv.org
- #mask-rcnn
- #instance-segmentation
- #roialign
- #object-detection
- #deep-learning
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles