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

I think there is error in focal loss #2

Open
suminlee94 opened this issue Sep 13, 2021 · 0 comments
Open

I think there is error in focal loss #2

suminlee94 opened this issue Sep 13, 2021 · 0 comments

Comments

@suminlee94
Copy link

 logpt = - F.binary_cross_entropy_with_logits(input, target, pos_weight=weight, reduction=self.reduction)
pt = torch.exp(logpt)

 # compute the loss
focal_loss = -( (1-pt)**self.gamma ) * logpt

'logpt' is actually -log(p_t).
so....pt is not same as log(sigmoid(input)).

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

1 participant