From c9a55a269b7dacb6c13bb167b10676b1798dea34 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 11 Apr 2019 15:29:31 +0200 Subject: [PATCH] updates --- utils/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index 91ac10cf..fa24b07f 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -256,10 +256,11 @@ def compute_loss(p, targets): # predictions, targets for i, pi0 in enumerate(p): # layer i predictions, i b, a, gj, gi = indices[i] # image, anchor, gridx, gridy tconf = torch.zeros_like(pi0[..., 0]) # conf + nt = len(b) # number of targets # Compute losses - k = 1 # nT / bs - if len(b) > 0: + k = 1 # nt / bs + if nt: pi = pi0[b, a, gj, gi] # predictions closest to anchors tconf[b, a, gj, gi] = 1 # conf