This commit is contained in:
Glenn Jocher 2019-04-26 13:28:00 +02:00
parent c5ec86082d
commit 7691e2e0f8
1 changed files with 3 additions and 3 deletions

View File

@ -255,7 +255,7 @@ def compute_loss(p, targets, model): # predictions, targets, model
bs = p[0].shape[0] # batch size bs = p[0].shape[0] # batch size
k = h['k'] * bs # loss gain k = h['k'] * bs # loss gain
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, gridy, gridx
tconf = torch.zeros_like(pi0[..., 0]) # conf tconf = torch.zeros_like(pi0[..., 0]) # conf
# Compute losses # Compute losses
@ -302,8 +302,8 @@ def build_targets(model, targets):
# Indices # Indices
b, c = t[:, :2].long().t() # target image, class b, c = t[:, :2].long().t() # target image, class
gxy = t[:, 2:4] * layer.ng gxy = t[:, 2:4] * layer.ng # grid x, y
gi, gj = gxy.long().t() # grid_i, grid_j gi, gj = gxy.long().t() # grid x, y indices
indices.append((b, a, gj, gi)) indices.append((b, a, gj, gi))
# XY coordinates # XY coordinates