RoI pooling divides rectangular regions of varying size on a feature map into a fixed number of bins and takes the maximum in each bin, producing small feature maps of the same size. An RoI (Region of Interest) is a candidate region likely to contain an object. The output size (e.g. 7ร7) is constant regardless of the region's size, so fully connected layers can follow it. It has no learnable parameters.
Girshick proposed it in 2015 as a component of the Fast R-CNN object detector. The earlier R-CNN cropped about 2,000 candidate regions from each image and passed them through a CNN one at a time, which made it very slow. SPP-net sped this up by computing the feature map of the whole image only once and extracting a feature for each region from it, but it could not update the convolutional layers when training for detection. With RoI pooling and a better training scheme, Fast R-CNN kept the speed while training everything, including the convolutional layers, jointly.
The paper describes RoI pooling as "a special case of the spatial pyramid pooling layer used in SPP-nets in which there is only one pyramid level". The way bins are divided is also the same as in SPP-net.
In the example in the top figure, the image RoI (20, 28)โ(76, 92) is divided by the feature map stride of 16 to give (1.25, 1.75)โ(4.75, 5.75), which is rounded to integers as the 4ร4 cells (1, 2)โ(5, 6). This is divided into 2ร2 bins, and their maxima 8, 9, 3, 6 form the output.


