Answers.Body: <ol>
  <li><p>The ROIs in the input space are mapped to the feature map space, by dividing it by the net stride at that layer. Say, in a network, after a sequence of four 2x2 pooling layers, your image is reduced to 1/16 of the original size. (A 32*32 image is reduced to 2x2) So, the bounding boxes in the original space are mapped to the feature space by dividing by the net stride, which is 16 here. But here's the catch, the ROI co-ordinates could be a floating point number when divided by 16, so, it is adjusted by either flooring it or ceiling it. This is why ROIPooling is <strong>quantized</strong>. There is a loss of information when you are rounding off the co-ordinates of the ROI. Nevertheless, now, each region is pooled to a single-size feature map, and <strong>each ROI is fed one-by-one to the following layers</strong>.
  The <a href="https://arxiv.org/abs/1703.06870" rel="nofollow noreferrer">Mask-RCNN paper</a> brings a change to the mapping to the feature space, by not rounding off the co-ordinates, and by <a href="https://en.wikipedia.org/wiki/Bilinear_interpolation#:%7E:text=In%20mathematics%2C%20bilinear%20interpolation%20is,again%20in%20the%20other%20direction." rel="nofollow noreferrer">bilinear interpolation</a>, and the loss of information is reduced, thus, the ROIAlign algorithm(which has been described here) performs better at object detection, than the quantized ROIPool algorithm.</p>
  </li>
  <li><p>As said, each fixed-size feature map vector is processed one-by-one.</p>
  </li>
  </ol>
  <p><a href="https://towardsdatascience.com/understanding-region-of-interest-part-2-roi-align-and-roi-warp-f795196fc193" rel="nofollow noreferrer">Reference</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-19T05:07:49.430Z
Answers.LastActivityDate: 2020-06-19T05:07:49.430Z
Answers.UserDisplayName: Arjun Ashok
Body: <p>I've been reading the <a href="https://arxiv.org/pdf/1504.08083.pdf" rel="nofollow noreferrer">Fast R-CNN paper</a>.</p>
  <p><strong>My understanding is</strong> that the input to one forward pass is the whole input image plus a list of RoIs (generated by selective search or another region proposal method). Then I understand that on the last convolution layer's feature map (<strong>let's call it FM</strong>), each <em>corresponding</em> RoI gets RoI-pooled, where now the corresponding ROIs are a rectangular (over height and width) slice of the FM tensor over all channels.</p>
  <p>But I'm <strong>having trouble with two concepts</strong>:</p>
  <ol>
  <li><p>How is the input RoI mapped to the corresponding RoI in FM? Each neuron comes from a very wide perceptive field, so, in a deep neural network, there's no way of making a 1:1 mapping between input neurons and neurons in the last convolution layer right?</p>
  </li>
  <li><p>Disregarding that I'm confused in point 1, once we have a bunch of RoIs in FM and we do the RoI pooling, we have N pooled feature vectors. Do we now run each of these through one FC network one by one? Or do we have N branches of FC networks? (that wouldn't make sense to me)</p>
  </li>
  </ol>
  <p>I have also read the <a href="https://arxiv.org/pdf/1506.01497v3.pdf" rel="nofollow noreferrer">faster R-CNN paper</a>. In the same way, I'm also interested to know about how the proposed regions from RPN map to the input of the RoI pooling in the Fast R-CNN layers. Because actually those proposed regions live in the space of the input image, not in the space of the deep feature map.</p>
  
Tags: <neural-networks><convolutional-neural-networks><computer-vision><r-cnn><pooling>
Title: In Fast R-CNN, how are input RoIs mapped to the respective RoIs in the feature map before RoI pooling?
UserDisplayName: Alexander Soare
ThreadText: # In Fast R-CNN, how are input RoIs mapped to the respective RoIs in the feature map before RoI pooling?
  
  (Asked by: username_0 on 2020-03-04)
  
  I've been reading the [Fast R-CNN paper](https://arxiv.org/pdf/1504.08083.pdf).
  
  **My understanding is** that the input to one forward pass is the whole input image plus a list of RoIs (generated by selective search or another region proposal method). Then I understand that on the last convolution layer's feature map (**let's call it FM**), each *corresponding* RoI gets RoI-pooled, where now the corresponding ROIs are a rectangular (over height and width) slice of the FM tensor over all channels.
  
  But I'm **having trouble with two concepts**:
  
  1. How is the input RoI mapped to the corresponding RoI in FM? Each neuron comes from a very wide perceptive field, so, in a deep neural network, there's no way of making a 1:1 mapping between input neurons and neurons in the last convolution layer right?
  2. Disregarding that I'm confused in point 1, once we have a bunch of RoIs in FM and we do the RoI pooling, we have N pooled feature vectors. Do we now run each of these through one FC network one by one? Or do we have N branches of FC networks? (that wouldn't make sense to me)
  
  I have also read the [faster R-CNN paper](https://arxiv.org/pdf/1506.01497v3.pdf). In the same way, I'm also interested to know about how the proposed regions from RPN map to the input of the RoI pooling in the Fast R-CNN layers. Because actually those proposed regions live in the space of the input image, not in the space of the deep feature map.
  
  **Tags:** neural-networks, convolutional-neural-networks, computer-vision, r-cnn, pooling
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-19. Score: 1 | Accepted answer
  
  1. The ROIs in the input space are mapped to the feature map space, by dividing it by the net stride at that layer. Say, in a network, after a sequence of four 2x2 pooling layers, your image is reduced to 1/16 of the original size. (A 32\*32 image is reduced to 2x2) So, the bounding boxes in the original space are mapped to the feature space by dividing by the net stride, which is 16 here. But here's the catch, the ROI co-ordinates could be a floating point number when divided by 16, so, it is adjusted by either flooring it or ceiling it. This is why ROIPooling is **quantized**. There is a loss of information when you are rounding off the co-ordinates of the ROI. Nevertheless, now, each region is pooled to a single-size feature map, and **each ROI is fed one-by-one to the following layers**.
     The [Mask-RCNN paper](https://arxiv.org/abs/1703.06870) brings a change to the mapping to the feature space, by not rounding off the co-ordinates, and by [bilinear interpolation](https://en.wikipedia.org/wiki/Bilinear_interpolation#:%7E:text=In%20mathematics%2C%20bilinear%20interpolation%20is,again%20in%20the%20other%20direction.), and the loss of information is reduced, thus, the ROIAlign algorithm(which has been described here) performs better at object detection, than the quantized ROIPool algorithm.
  2. As said, each fixed-size feature map vector is processed one-by-one.
  
  [Reference](https://towardsdatascience.com/understanding-region-of-interest-part-2-roi-align-and-roi-warp-f795196fc193)
  
  
  ---
  
  