-
Notifications
You must be signed in to change notification settings - Fork 72
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
Cost function in Yolo-v1 #3
Comments
The cost function in YOLO-V2 is right in this project? |
@christophesaintjean Thank you for your question. In the function model.yolo.Objectives.init, the tensors "mask_best" and "mask_normal" representing The tensor "mask_best" requires two conditions: the cell contains an object (self.mask) AND the bbox has the best IoU value in its cell (best_box). Because "best_box_iou" calculates the best IoU value of each independent cell, and "best_box" requires the IoU value of a bbox equals "best_box_iou". So it will be 0 if its IoU is not the best in its cell. |
@TaihuLight Yes, I've checked it. |
@ruiminshen, i studied more your code and noticed that i agree your comment
I am implementing Yolo-v1 with Keras. My implementation for these two losses are as the following:
So maybe, there is a very subtle difference between our interpretations:
At the end, it is the same loss since IOU is 1 for the best box in the learning step. Best regards, ps: thank you very much for having shared your valuable code. |
Hi,
I think there is an error with the cost function in Yolo-v1.
In the original paper, the authors said that the confidence value should be :
- the IOU for the best box in a cell that contains an object (1_{ij}^{obj})
- and zero elsewhere (1_{ij}^{noobj})
For me, the confidence of boxes in a cell that contains an object BUT are not the best should be 0.
This leads to a different formulation of self['iou_normal'] which appears hard to reproduce without model.confidence variable:
self['iou_normal'] = tf.reduce_sum(mask_normal * tf.square(model.confidence), name='iou_normal')
Do you think i am right or wrong ?
Best regards,
Christophe.
The text was updated successfully, but these errors were encountered: