diff --git a/layers/box_utils.py b/layers/box_utils.py index 41b244273..46a83351e 100644 --- a/layers/box_utils.py +++ b/layers/box_utils.py @@ -130,7 +130,7 @@ def encode(matched, priors, variances): g_cxcy /= (variances[0] * priors[:, 2:]) # match wh / prior wh g_wh = (matched[:, 2:] - matched[:, :2]) / priors[:, 2:] - g_wh = torch.log(g_wh) / variances[1] + g_wh = torch.log(g_wh + 1e-10) / variances[1] # return target for smooth_l1_loss return torch.cat([g_cxcy, g_wh], 1) # [num_priors,4]