This commit is contained in:
Glenn Jocher 2019-04-11 15:29:31 +02:00
parent 53b9892216
commit c9a55a269b
1 changed files with 3 additions and 2 deletions

View File

@ -256,10 +256,11 @@ def compute_loss(p, targets): # predictions, targets
for i, pi0 in enumerate(p): # layer i predictions, i for i, pi0 in enumerate(p): # layer i predictions, i
b, a, gj, gi = indices[i] # image, anchor, gridx, gridy b, a, gj, gi = indices[i] # image, anchor, gridx, gridy
tconf = torch.zeros_like(pi0[..., 0]) # conf tconf = torch.zeros_like(pi0[..., 0]) # conf
nt = len(b) # number of targets
# Compute losses # Compute losses
k = 1 # nT / bs k = 1 # nt / bs
if len(b) > 0: if nt:
pi = pi0[b, a, gj, gi] # predictions closest to anchors pi = pi0[b, a, gj, gi] # predictions closest to anchors
tconf[b, a, gj, gi] = 1 # conf tconf[b, a, gj, gi] = 1 # conf