From d602aed1d859d0f457570834aff6642c405aa134 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 26 Aug 2018 21:41:35 +0200 Subject: [PATCH] updates --- models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models.py b/models.py index a01bef92..ea86a726 100755 --- a/models.py +++ b/models.py @@ -132,7 +132,7 @@ class YOLOLayer(nn.Module): if targets is not None: BCEWithLogitsLoss = nn.BCEWithLogitsLoss() MSELoss = nn.MSELoss() # version 0.4.0 - # CrossEntropyLoss = nn.CrossEntropyLoss() + CrossEntropyLoss = nn.CrossEntropyLoss() if requestPrecision: gx = self.grid_x[:, :, :nG, :nG] @@ -159,8 +159,8 @@ class YOLOLayer(nn.Module): lh = 5 * MSELoss(h[mask], th[mask]) lconf = 1.5 * BCEWithLogitsLoss(pred_conf[mask], mask[mask].float()) - # lcls = CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1)) - lcls = BCEWithLogitsLoss(pred_cls[mask], tcls.float()) + lcls = CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1)) + # lcls = BCEWithLogitsLoss(pred_cls[mask], tcls.float()) else: lx, ly, lw, lh, lcls, lconf = FT([0]), FT([0]), FT([0]), FT([0]), FT([0]), FT([0])