5
$\begingroup$

I am reading this paper on how yolo defines loss function. https://arxiv.org/abs/1506.02640

I did research on other posts, but these posts did not seem to answer my confusion: (How to calculate the class probability of a grid cell in YOLO object detection algorithm? & Yolo Loss function explanation)

Sum-squared error also equally weights errors in large boxes and small boxes. Our error metric should reflect that small deviations in large boxes matter less than in small boxes. To partially address this we predict the square root of the bounding box width and height instead of the width and height directly.

enter image description here

I could not make myself clear why applying square root could help resolve the case Sum-squared error also equally weights errors in large boxes and small boxes and give me any intuitions if possible!

Thanks so much!

$\endgroup$
1
  • $\begingroup$ Thank you for the question $\endgroup$
    – Avv
    Commented Jan 2, 2023 at 5:20

2 Answers 2

3
$\begingroup$

The intuition or the goal is that regression errors relative to their respective bounding box size should matter roughly equally. E.g. a 5px deviation on a 500px wide box should have less of an effect on the loss as a 5px deviation in a 20px wide box. The square root downscales high values while less affecting low values of width and height.

The normal sum of squared errors will just punish the deviation independent of the size of the box.

$\endgroup$
0
$\begingroup$

YOLOv1 from Scratch explains as below. It also explains other considerations made in the loss function design.

Lets say we have a very large bounding box and we take those subtracts and squared, that squared will be very large. But for a small bounding box, the loss will not be as large.

So what they do is to take the square root to make sure we prioritise smaller bounding boxes equally as much as we do for large bounding boxes.

enter image description here

Taking square root before square reduces the loss impacts due to the bounding box sizes.

$\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.