Reputation:
I am trying to understand the concept of Faster RCNN.
For example, in an image(224×224), there are only two objects. To create a mini-batch of anchors of length 256(128-Foreground, 128-background) from the image, I get only 30 anchors which IOU is greater than 0.7 when compared with the ground truth bounding box.
In this situation, how should I make the foreground objects balanced with background?
Upvotes: 2
Views: 1146
Reputation: 8298
You can just get rid or set a predefined ratio between the foreground to the background.
In the following link, he set the ratio of foreground to background to be 1/3.
The github of this tutorial is:
https://github.com/dongjk/faster_rcnn_keras/blob/master/RPN.py
It's a full tutorial that walks through the steps before training a Faster-RCNN, in your case the RPN script in the GitHub has the solution you are after.
Note that you do not want a full balance but a reasonable ratio, because in most cases the background is the majority of the image in case of a very specific dataset that this is not the case.
Upvotes: 1