An object detection model assigns class probabilities and bounding-box coordinates to regions of interest, combining classification with spatial localization. section 11.4.3
In Fast R-CNN, a convolutional backbone computes one feature map for the whole image. RoI pooling maps each proposed region onto that feature map and produces a fixed-size representation through max pooling, avoiding a separate CNN pass for every region. section 11.4.3
Fast R-CNN RoI head
A PyTorch RoI head feeds pooled features through fully connected layers, then emits class scores and four-coordinate regression outputs for each class. Training combines cross-entropy classification loss with Smooth L1 regression loss for positive regions; inference selects the most probable class and its corresponding offsets. section 11.4.3
Figure 11.18 A conv feature map with two regions of interest of different sizes. RoI pooling extracts a fixed-sized output feature map (2 × 2 in this image) from each of the RoIs in a single pass via max pooling. This enables us to extract fixed-sized representative feature vectors for each RoI, which are then fed into further classifier and regressor layers for classification and localization.
Compare differently sized regions as they become fixed-sized 2 × 2 feature maps through RoI pooling. section 11.4.3

