Course contentsShow
← Machine Learning and Deep Learning
Lesson 957 of 3,53822. Computer Vision TasksFree lesson

Region of Interest (RoI) Pooling

Understand how RoI pooling extracts fixed-size features from arbitrary-sized regions in feature maps.

Region of Interest (RoI) Pooling

You'll learn how RoI pooling creates fixed-size feature representations from variable-sized bounding box proposals in a feature map.

What Problem Does RoI Pooling Solve?

In Fast R-CNN, we have a feature map from our CNN and multiple region proposals (bounding boxes) of different sizes and aspect ratios. But our fully connected classification head expects a fixed-size input. How do we convert these arbitrary-sized regions into uniform-sized features?

The Core Idea

RoI pooling is like taking a flexible grid and stretching it over each region proposal, then extracting one value from each grid cell.

Here's how it works:

  1. Project the bounding box from the original image coordinates onto the feature map (accounting for the downsampling from pooling and stride)
  2. Divide the RoI into a fixed grid (e.g., 7×7 cells), regardless of the RoI's actual size
  3. Apply max pooling within each grid cell independently
  4. Output a fixed-size feature map (e.g., 7×7×channels)

An Analogy

Imagine you're selecting produce from bins of different sizes at a market. Some bins are large, some small. RoI pooling is like laying down a 7×7 grid over each bin (stretching to fit), then picking the best item from each grid square. You always end up with exactly 7×7 items, no matter the bin size.

Why This Matters

RoI pooling enables Fast R-CNN to process all region proposals in a single forward pass through the network. Each proposal gets converted to the same size (e.g., 7×7×512), making it compatible with the fixed-size fully connected layers that follow.

Key Takeaway: RoI pooling transforms arbitrary-sized regions in a feature map into fixed-size outputs by dividing each region into a grid and max-pooling within each cell, enabling efficient batch processing of multiple proposals.