yolov2.pytorch
yolov2.pytorch copied to clipboard
about loss
hello, tztztztztz: thankyou for your opensource code, it's very good! but i have a question about loss, i read some blog about the loss, the yolov2 loss is like the picture, two red box in the picture is not find in your loss.py, is i didn't find or you do not write?
Hi,
Thank you for using this repo! In fact, the two losses in the red boxes ARE INCLUDED in the loss function.
https://github.com/tztztztztz/yolov2.pytorch/blob/014559ce4df8f7e580e339919a05a05d988073a4/loss.py#L218-L219
For box losses, the losses for both obj_coord and noobj_coord are included in a single tensor. Since the loss for noobj_coord is actually 0, I use a box_mask
to mask out losses of noobj_coord.
For conf losses (iou_loss), the loss weights for conf_obj and conf_noobj are set by iou_mask
https://github.com/tztztztztz/yolov2.pytorch/blob/014559ce4df8f7e580e339919a05a05d988073a4/loss.py#L61 https://github.com/tztztztztz/yolov2.pytorch/blob/014559ce4df8f7e580e339919a05a05d988073a4/loss.py#L159