align loss to darknet
This commit is contained in:
parent
750f528bfe
commit
a75119b8f0
|
@ -159,8 +159,8 @@ class YOLOLayer(nn.Module):
|
||||||
# Mask outputs to ignore non-existing objects (but keep confidence predictions)
|
# Mask outputs to ignore non-existing objects (but keep confidence predictions)
|
||||||
nT = sum([len(x) for x in targets]) # number of targets
|
nT = sum([len(x) for x in targets]) # number of targets
|
||||||
nM = mask.sum().float() # number of anchors (assigned to targets)
|
nM = mask.sum().float() # number of anchors (assigned to targets)
|
||||||
nB = len(targets) # batch size
|
# nB = len(targets) # batch size
|
||||||
k = 1 / nB
|
k = 1
|
||||||
if nM > 0:
|
if nM > 0:
|
||||||
lx = k * MSELoss(x[mask], tx[mask])
|
lx = k * MSELoss(x[mask], tx[mask])
|
||||||
ly = k * MSELoss(y[mask], ty[mask])
|
ly = k * MSELoss(y[mask], ty[mask])
|
||||||
|
|
Loading…
Reference in New Issue