From c09fcfc4fe3a5b478cecf5c26de88468bc4ab1d9 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 16 Mar 2020 14:18:56 -0700 Subject: [PATCH] EMA class updates --- utils/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/utils.py b/utils/utils.py index 929f6ba4..82b75d41 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -349,7 +349,8 @@ class FocalLoss(nn.Module): def forward(self, pred, true): loss = self.loss_fcn(pred, true) - # loss *= self.alpha * (1.000001 - torch.exp(-loss)) ** self.gamma # non-zero power for gradient stability + # p_t = torch.exp(-loss) + # loss *= self.alpha * (1.000001 - p_t) ** self.gamma # non-zero power for gradient stability # TF implementation https://github.com/tensorflow/addons/blob/v0.7.1/tensorflow_addons/losses/focal_loss.py pred_prob = torch.sigmoid(pred) # prob from logits