From 8f5d652d41cea2f887f1a73cde1caa9f8a62cf8e Mon Sep 17 00:00:00 2001 From: Carl Lemaire Date: Wed, 28 Feb 2018 10:55:26 -0500 Subject: [PATCH] Fix infinity in target boxes --- layers/box_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]