RoI Align
Region of Interest Align
RoI Align is an advanced pooling operation that solves spatial misalignment in object detection and segmentation, being fundamental for models like Mask R-CNN.
The Problem RoI Align Solves
Before RoI Align, the standard architecture (like in Faster R-CNN) used RoI Pooling. The critical problem with RoI Pooling was quantization (rounding).
When a network proposes a region of interest (e.g., a box with floating-point coordinates like x = 10.4, y = 20.8), RoI Pooling does the following:
- Rounds these coordinates to align perfectly with the integer pixel grid of the feature map (e.g.,
x = 10, y = 21). - When dividing this region into spatial bins (e.g., 7x7), it rounds again to force alignment with the integer grid.
⚠️ This double rounding generates severe spatial misalignment. For classification this is acceptable, but for instance segmentation, where precision must be at the pixel level to generate accurate masks, this error destroys the object boundaries.
How RoI Align Works
RoI Align completely eliminates quantization.
- Floating Coordinates: It maintains the continuous values of the region of interest.
- Exact Division: It divides the region into bins maintaining the exact fractional sizes.
- Bilinear Interpolation: For each bin, RoI Align defines 4 regular sampling points. Since these rarely fall exactly on an integer “pixel”, it uses bilinear interpolation to compute the exact value based on the 4 nearest neighboring pixels in the feature map.
- Aggregation: It applies max or average pooling to these interpolated values.
Interview Summary
“RoI Align is a feature extraction technique that uses bilinear interpolation instead of rounding (quantization) to map proposed regions to a fixed-size feature map. It prevents the spatial misalignment that occurred in the classic RoI Pooling, making it crucial for pixel-accurate tasks like instance segmentation in Mask R-CNN.”
Related: Mask R-CNN · object-detection · faster-r-cnn