updates
This commit is contained in:
parent
a8f8ec134b
commit
9514e74438
|
@ -159,14 +159,16 @@ class YOLOLayer(nn.Module):
|
||||||
lh = 5 * MSELoss(h[mask], th[mask])
|
lh = 5 * MSELoss(h[mask], th[mask])
|
||||||
lconf = 1.5 * BCEWithLogitsLoss1(pred_conf[mask], mask[mask].float())
|
lconf = 1.5 * BCEWithLogitsLoss1(pred_conf[mask], mask[mask].float())
|
||||||
|
|
||||||
lcls = nM * CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1))
|
# lcls = nM * CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1))
|
||||||
# lcls = nM * BCEWithLogitsLoss2(pred_cls[mask], tcls.float())
|
lcls = nM * BCEWithLogitsLoss2(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])
|
||||||
|
|
||||||
lconf += nM * BCEWithLogitsLoss2(pred_conf[~mask], mask[~mask].float())
|
lconf += nM * BCEWithLogitsLoss2(pred_conf[~mask], mask[~mask].float())
|
||||||
|
|
||||||
loss = lx + ly + lw + lh + lconf + lcls
|
loss = lx + ly + lw + lh + lconf + lcls
|
||||||
|
|
||||||
|
# Sum False Positives from unnasigned anchors
|
||||||
i = torch.sigmoid(pred_conf[~mask]) > 0.99
|
i = torch.sigmoid(pred_conf[~mask]) > 0.99
|
||||||
FPe = torch.zeros(self.nC)
|
FPe = torch.zeros(self.nC)
|
||||||
if i.sum() > 0:
|
if i.sum() > 0:
|
||||||
|
|
Loading…
Reference in New Issue