-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probably a bug in loss function #4
Comments
Hi @nsmetanin , Thank you for being interested in my work and pointing this bug. I will have to look into the code again since I have not actively worked on it for a while. Best, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Dat,
It looks like there is a bug around the line https://github.com/dat-ai/yolov2/blob/master/models/YOLOv2.py#L346
I'm not 100% sure, but it looks like there's some value range mismatch:
At first, there's ground truth xy and wh. They both (true_box_xy and true_box_wh^2) have values relative to image shape (according to data_generator.py script), ranged from 0.0 to 1.0
true_box_xy = y_true[:, :, :, :, 0:2]
true_box_wh = tf.sqrt(y_true[:, :, :, :, 2:4])
But then there's upper-left corner calculation which involves original true_box_xy minus half of true_box_wh^2 multiplied by output_size, which could be > 1.0 and seems incorrect.
true_tem_wh = tf.pow(true_box_wh, 2) * output_size
true_box_ul = true_box_xy - 0.5 * true_tem_wh
For pred_* variables the problem is the same.
As for me, the one solution is to not multiply wh by output size before corners calculation, another one is to make xy values relative to a cell.
BTW, it still trains somehow.
The text was updated successfully, but these errors were encountered: