Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bounded regression loss #10

Open
PalkoNazar opened this issue May 20, 2021 · 0 comments
Open

Bounded regression loss #10

PalkoNazar opened this issue May 20, 2021 · 0 comments

Comments

@PalkoNazar
Copy link

https://github.com/SsisyphusTao/SSD-Knowledge-Distillation/blob/0597fbee635afcf0b8710ba3a9e40ab9f010aea5/nets/multibox_loss.py#L17-L23
F.mse_loss has reduction='mean' by default, but we should use reduction='sum' as for loss_l
https://github.com/SsisyphusTao/SSD-Knowledge-Distillation/blob/0597fbee635afcf0b8710ba3a9e40ab9f010aea5/nets/multibox_loss.py#L120
I think the next code corresponds to the formula from the article.

def bounded_regression_loss(Rs, Rt, gt, m, v=0.5):
    loss = torch.sum(F.mse_loss(Rs, gt, reduction='none'), 1)
    return torch.sum(loss * (loss + m > torch.sum(F.mse_loss(Rt, gt, reduction='none'), 1))) * v
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant