0
$\begingroup$

I am dealing with Yolo Loss Function (the following). $$\begin{align} &\lambda_{coord} \sum_{i=0}^{S^2}\sum_{j=0}^B \mathbb{1}_{ij}^{obj}[(x_i-\hat{x}_i)^2 + (y_i-\hat{y}_i)^2 ] \\&+ \lambda_{coord} \sum_{i=0}^{S^2}\sum_{j=0}^B \mathbb{1}_{ij}^{obj}[(\sqrt{w_i}-\sqrt{\hat{w}_i})^2 +(\sqrt{h_i}-\sqrt{\hat{h}_i})^2 ]\\ &+ \sum_{i=0}^{S^2}\sum_{j=0}^B \mathbb{1}_{ij}^{obj}(C_i - \hat{C}_i)^2 + \lambda_{noobj}\sum_{i=0}^{S^2}\sum_{j=0}^B \mathbb{1}_{ij}^{noobj}(C_i - \hat{C}_i)^2 \\ &+ \sum_{i=0}^{S^2} \mathbb{1}_{i}^{obj}\sum_{c \in classes}(p_i(c) - \hat{p}_i(c))^2 \\ \end{align}$$

I cannot understand how to use it. That is, the "hat" variables are the right ones (related to the training set), while the standard variables are the predicted ones. However, it has some sense if there is a one-to-one corrispondence between the two kind of variables.

But what should happens if my model predicts an airplane while there are not?

I know the predicted center ($x_i,y_i$) and the predicted whidth and height ($w_i,h_i$) but since there are no airplanes what sould be the related hat variables?

Also, what is the meaning of $\hat{p}_i(c)$ since I have the certainess that that object belong to that class? It should be 1?

Thanks in advance :)

$\endgroup$
2
  • 1
    $\begingroup$ Usually, the "hat" variables are the predicted ones and the "standard" ones are the right ones. Are you sure it is different in your case? $\endgroup$
    – nope
    Commented Jan 7, 2019 at 12:22
  • 1
    $\begingroup$ No, but it doesn't matter. They're interchangable. $\endgroup$
    – aleio1
    Commented Jan 7, 2019 at 13:01

1 Answer 1

0
$\begingroup$

YOLOv1 from Scratch explains the loss function design and implementation. e.g. Hat ^ means a predicted value, so $y - \hat{y}$ means subtracting predicted value.

If there is no object in the cell, then the identify function $\mathbb{1}_{ij}^{obj}$ returns 0 and the bounding boxes has no contribution to the loss.

enter image description here

It explains other considerations e.g. questioned in YOLO loss function width and height component explanation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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