diff --git a/models.py b/models.py index 25ac4dcf..ca5f07d2 100755 --- a/models.py +++ b/models.py @@ -182,7 +182,7 @@ class YOLOLayer(nn.Module): loss = lx + ly + lw + lh + lconf + lcls # Sum False Positives from unassigned anchors - i = torch.sigmoid(pred_conf[~mask]) > 0.9 + i = torch.sigmoid(pred_conf[~mask]) > 0.5 if i.sum() > 0: FP_classes = torch.argmax(pred_cls[~mask][i], 1) FPe = torch.bincount(FP_classes, minlength=self.nC).float().cpu() # extra FPs diff --git a/utils/utils.py b/utils/utils.py index 95abacce..08692c5f 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -282,9 +282,9 @@ def build_targets(pred_boxes, pred_conf, pred_cls, target, anchor_wh, nA, nC, nG pconf = torch.sigmoid(pred_conf[b, a, gj, gi]).cpu() iou_pred = bbox_iou(tb, pred_boxes[b, a, gj, gi].cpu()) - TP[b, i] = (pconf > 0.9) & (iou_pred > 0.5) & (pcls == tc) - FP[b, i] = (pconf > 0.9) & (TP[b, i] == 0) # coordinates or class are wrong - FN[b, i] = pconf <= 0.9 # confidence score is too low (set to zero) + TP[b, i] = (pconf > 0.5) & (iou_pred > 0.5) & (pcls == tc) + FP[b, i] = (pconf > 0.5) & (TP[b, i] == 0) # coordinates or class are wrong + FN[b, i] = pconf <= 0.5 # confidence score is too low (set to zero) return tx, ty, tw, th, tconf, tcls, TP, FP, FN, TC