This blog post mainly synthesizes the answers of the two previous answerers, here only for the purpose of learning records:
Reference connection: https://www.zhihu.com/question/65587875
There are two variables in the Faster R-CNN code that are difficult to understand: bbox_inside_weights and bbox_outside_weights. After referring to some answers, understand a little bit, and record briefly here.
1. bbox_inside_weights
Used to set the weight of positive sample regression loss, the default is 1.
You can see the second half of the bounding box regression, where Pi * refers to regression only for the foreground (fg), and bbox_inside_weights refers to this.
In the code block, initially inside_weights is an all-zero matrix, and then write (1.0, 1.0, 1.0, 1.0) where label = 1
2. bbox_outside_weights
The bbox_outside_weights should be Nreg, which acts as a denominator.