Reputation: 49
My question is regarding the implementation of Faster R-CNN.
I read the paper and was going through the config.py file is written by the author of the algorithm which is available here: https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/fast_rcnn/config.py
I am quite unable to understand that why do we need BBOX_INSIDE_WEIGHTS (mentioned at line 84) and RPN_POSITIVE_WEIGHT (mentioned at line 124)?
In some other implementation, I also saw anchor masks (line 659), anchor regression weights and anchor regression masks which are available here: https://github.com/DeepRNN/object_detection/blob/master/model.py
Can some one please give the simple and easy answer that what are these parameters for and why do we actually need them?
Upvotes: 1
Views: 802
Reputation: 3279
In faster RCNN you have a RPN (Region Proposal Network) which is part of the model and it is trained with the all network
The role of the RPN is to suggest bounding boxes in the image on which an object is believed to be.
For each location in the image the RPN tries to fit each one of the k predefined "anchors" and for each one of them it gives 4 parameters which define the bounding box proposal in relative to the anchor and 2 probability scores for the probability of an object to be inside the bounding box.
The anchors are a predefined set if boxes with different aspect ratios and scales.
If we look at the code at code at line 359 and 360 where we calculate the loss we can see that "anchor masks" is used to define the the areas in the image with true regression anchors. This is because in the definition of the loss function of Fast-RCNN we calculate the loss of the regression only for positive anchors.
The same applies for "anchor_reg_masks" as can be seen in line 362.
The term "anchor_weights" is used to normalize the loos0 term. After line 359 the loss0 has zero loss for locations that are not in the mask therefor if we compute the loss from this we will get bias results. The "anchor_weights" normalize the loss0 to be calculated only from the true anchors.
Upvotes: 1