We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Two questions
alpha_t
pt = torch.log(p) * target.float() + torch.log(1.0 - p) * (1 - target).float()
class FocalLoss(nn.Module): def __init__(self, alpha=0.25, gamma=2, device="cuda:0", eps=1e-10): super().__init__() self.alpha = alpha self.gamma = gamma self.device = device self.eps = eps def forward(self, input, target): p = torch.sigmoid(input) pt = p * target.float() + (1.0 - p) * (1 - target).float() alpha_t = (1.0 - self.alpha) * target.float() + self.alpha * (1 - target).float() loss = - 1.0 * torch.pow((1 - pt), self.gamma) * torch.log(pt + self.eps) return loss.sum()
The text was updated successfully, but these errors were encountered:
Maintainers, kindly respond (or provide hint)
Sorry, something went wrong.
No branches or pull requests
Two questions
alpha_t
is unused below.The text was updated successfully, but these errors were encountered: