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

Incorrect Focal-R mse loss? #16

Closed
5uperpalo opened this issue Jan 3, 2022 · 2 comments
Closed

Incorrect Focal-R mse loss? #16

5uperpalo opened this issue Jan 3, 2022 · 2 comments

Comments

@5uperpalo
Copy link

Hi authors,

page 6 from your paper:
Precisely, Focal-R loss based on L1 distance can be written as 1/n∑n i=1 σ(|βei|)γ ei, where ei is the L1 error for i-th sample, σ(·)

  • QUESTION 1 : in the focal_mse loss:
    (2 * torch.sigmoid(beta * torch.abs(inputs - targets)) - 1) ** gamma

    should be torch.abs((inputs - targets)**2) and not only torch.abs(inputs - targets), am I correct?
  • QUESTION 2 : why is there 2*torch.abs(...)-1 ? you do not have and -1 or 2* in the function in your paper?
@YyzHarry
Copy link
Owner

YyzHarry commented Jan 4, 2022

QUESTION 1 : in the focal_mse loss...

This is a good catch. Since there's already a hyper-parameter beta to control the "scaling" effect, we did not use the squared error -- but one could always try that (and tune the value of beta correspondingly).

QUESTION 2 : why is there 2*torch.abs(...)-1

This is because sigmoid(x) is in [0.5, 1] for all x>=0, so we simple scale it back to [0, 1]. If you choose activation as 'tanh', you do not need to rescale it. Since it's an engineering issue, for cleanness, we did not expand the detail in paper.

@5uperpalo
Copy link
Author

thank you! now it's clear to me :)

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

2 participants