1
$\begingroup$

The RPN loss in Faster RCNN paper is

$$ L({p_i}, {t_i}) = \frac{1}{N_{cls}} \sum_{i} L_{cls}(p_i,p_i^*) + \lambda \frac{1}{N_{reg}} \sum_i p_i^* L_{reg}(t_i, t_i^*) $$

For regression problems, we have the following parametrization

$$t_x=\frac{x - x_a}{w_a}, t_y=\frac{y−y_a}{h_a}, t_w= \log \left( \frac{w}{w_a} \right), t_h= \log \left(\frac{h}{h_a} \right)$$

and the ground-truth labels are

$$t_x^*=\frac{x^* - x_a}{w_a}, t_y^*=\frac{y^*−y_a}{h_a}, t_w^*= \log \left( \frac{w^*}{w_a} \right), t_h^*= \log \left(\frac{h^*}{h_a} \right)$$

where

  • $x$ and $y$ are the two coordinates of the center, $w$ the width, and $h$ the height of the predicted box.

  • $x$ and $y$ are the two coordinates of the center, $w$ the width, and $h$ the height of the anchor box.

  • $L_{reg}(t_i, t_i^*) = R(t_i − t_i^*)$, where $R$ is a robust loss function (smooth $L_1$)

How can I get the predicted box?

And Lreg = SmoothL1(t−t∗), is that add up tx,ty,tw,th and minus the sum of tx,ty,tw,th?

$\endgroup$
  • $\begingroup$ Hi and welcome to this community. I've edited your post to clarify it and add latex format. Your questions (especially the last one) are not clear though. Please, edit your post to clarify it. $\endgroup$ – nbro Dec 4 '19 at 14:27
  • $\begingroup$ Thank you very much! $\endgroup$ – user31844 Dec 6 '19 at 1:40
  • $\begingroup$ Please, clarify your last sentence "And Lreg = SmoothL1(t−t∗), is that add up tx,ty,tw,th and minus the sum of tx,ty,tw,th?". What are you asking here? $\endgroup$ – nbro Dec 6 '19 at 1:44
0
$\begingroup$

If I understood well you have 2 questions.

  • How to get the bounding box given the network output
  • What Smooth L1 loss is

The answer to your first question lies in the equation (2) in the section 3.2.1 from the Faster R-CNN paper. As all anchor based object detector (Faster RCNN, YOLOv3, EfficientNets, FPN...) the regression output from the network are not the bounding box coordinates. The regression output predicts the shift of the predicted bounding box with respect to the selected anchor (all of these networks, use more than 1 anchor per location, check section 3.1.1 from the paper).

So basically what your network predict is $t_x, t_y, t_w, t_h$:

enter image description here

And the bounding box coordinates are $x, y, w, h$, and the anchor coordinates are $x_a, y_a, w_a, h_a$. So in order to compute $x, y, w, h$ from $t_x, t_y, t_w, t_h$, you just have to invert the equations above. However I think you could gain more intuition about it if you take your time and read the whole section 3.1 from the paper. I know sometimes is a pain, but you will grasp the high level concept.

With regard to your second question. Yes the loss is computed with the output from the network and the "coded" ground truth, meaning you compute the loss with the paramters $t$ (predicted) against $t^*$ (coded ground truth) instead for computing loss with the real coordinates of the bounding boxes (decoded output from the network). For the equation on Smooth L1 loss check this wonderful documentation.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.