ROI Align vs ROI Pooling
What you'll learn: How ROI Align eliminates quantization errors that plague ROI Pooling, preserving precise spatial information critical for pixel-perfect mask prediction in instance segmentation.
The Problem with ROI Pooling
You've already learned that ROI Pooling extracts fixed-size feature maps from regions of interest. However, it has a hidden flaw: quantization errors.
When ROI Pooling maps a region proposal onto the feature map, it rounds coordinates to the nearest integer. Then, when dividing the region into bins, it rounds again. These two rounding steps cause misalignment between the original region and the extracted features—pixels don't line up precisely.
For object detection with bounding boxes, this slight misalignment is tolerable. But for instance segmentation, where you need pixel-accurate masks, these errors compound and degrade mask quality significantly.
How ROI Align Fixes This
ROI Align preserves spatial precision by avoiding quantization altogether:
- No rounding of coordinates – Keeps exact floating-point positions
- Bilinear interpolation – For each sampling point (even at fractional locations), computes values by interpolating from the four nearest grid points
- Precise spatial alignment – Features stay perfectly aligned with the original image pixels
An Analogy
Think of ROI Pooling like snapping a photo to a grid of squares—you lose precision at the edges. ROI Align is like using a high-resolution scanner that respects exact boundaries, interpolating smoothly between pixels rather than forcing everything onto a rigid grid.
Why It Matters for Mask R-CNN
In Mask R-CNN, the mask prediction branch requires precise spatial correspondence. Even small misalignments accumulate and blur mask boundaries. ROI Align ensures the features fed to the mask head maintain perfect alignment with the original object's position, enabling sharp, accurate segmentation masks.
Key Takeaway: ROI Align replaces quantization with bilinear interpolation, preserving spatial precision essential for high-quality mask prediction in instance segmentation tasks.