Skip to content
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

KL-Loss very large #13

Closed
EternityZY opened this issue Jul 3, 2019 · 5 comments
Closed

KL-Loss very large #13

EternityZY opened this issue Jul 3, 2019 · 5 comments

Comments

@EternityZY
Copy link

The kl-loss has three parts :bbox_pred_std_abs_mulw_loss, bbox_pred_std_abs_logw_loss,loss_bbox.

When I add it, bbox_pred_std_abs_logw_loss will be a very large negative number, resulting in a final loss=nan. If only loss_bbox is optimized, then log_loss will become a very large positive number, making the final loss_bbox almost zero. How to calculate kl-loss I can reproduce in the code, but how can you train me in the end, can you help me?

@ethanhe42
Copy link
Owner

ethanhe42 commented Jul 3, 2019

All three parts are needed in training, u cannot just optimize loss_bbox. bbox_pred_std_abs_mulw_loss, bbox_pred_std_abs_logw_loss produces gradients for std, loss_bbox produces gradients for bbox.
Are u training on ur own dataset or COCO?
If u train on COCO as the README suggests https://github.com/yihui-he/KL-Loss#training , u will get the same results as in the paper.
If u train on ur own dataset, there's nothing I can help.

@EternityZY
Copy link
Author

Thanks for your reply, I am training COCO + YOLOv3, now bbox_pred_std_abs_logw_loss is a very small negative number, and it will get smaller and smaller.
Is these three items simple to add?

@ethanhe42
Copy link
Owner

yes, but as I said, bbox_pred_std_abs_mulw_loss, bbox_pred_std_abs_logw_loss produces gradients for std, loss_bbox produces gradients for bbox.

@csu-qwjy
Copy link

but, bbox_pred_std_abs_mulw_loss gradients will also go to bbox and std, because of bbox_pred_std_abs_mulw_loss=bbox_pred_std_abs*('bbox_pred'- 'bbox_targets'), resulting in a final loss=nan

@ethanhe42
Copy link
Owner

ethanhe42 commented Nov 22, 2019

@ethanhe42 ethanhe42 pinned this issue Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants