This commit is contained in:
Glenn Jocher 2018-11-17 14:37:36 +01:00
parent 1415a798fe
commit aa895d2a07
1 changed files with 4 additions and 4 deletions

View File

@ -168,14 +168,14 @@ class YOLOLayer(nn.Module):
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])
lw = (k * 1) * MSELoss(w[mask], tw[mask]) lw = k * MSELoss(w[mask], tw[mask])
lh = (k * 1) * MSELoss(h[mask], th[mask]) lh = k * MSELoss(h[mask], th[mask])
# lconf = k * BCEWithLogitsLoss(pred_conf[mask], mask[mask].float()) # lconf = k * BCEWithLogitsLoss(pred_conf[mask], mask[mask].float())
lconf = (k * 10) * BCEWithLogitsLoss(pred_conf, mask.float()) lconf = (k * 10) * BCEWithLogitsLoss(pred_conf, mask.float())
# lcls = (k / 10) * CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1)) lcls = (k / 10) * CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1))
lcls = (k * 10) * BCEWithLogitsLoss(pred_cls[mask], tcls.float()) # lcls = (k * 10) * BCEWithLogitsLoss(pred_cls[mask], tcls.float())
else: else:
lx, ly, lw, lh, lcls, lconf = FT([0]), FT([0]), FT([0]), FT([0]), FT([0]), FT([0]) lx, ly, lw, lh, lcls, lconf = FT([0]), FT([0]), FT([0]), FT([0]), FT([0]), FT([0])