create step lr schedule
This commit is contained in:
parent
c01b8e6b7c
commit
07ac4fef8d
|
@ -170,8 +170,8 @@ class YOLOLayer(nn.Module):
|
||||||
# lconf = k * BCEWithLogitsLoss(pred_conf[mask], mask[mask].float())
|
# lconf = k * BCEWithLogitsLoss(pred_conf[mask], mask[mask].float())
|
||||||
lconf = k * BCEWithLogitsLoss(pred_conf, mask.float())
|
lconf = k * BCEWithLogitsLoss(pred_conf, mask.float())
|
||||||
|
|
||||||
lcls = k * CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1))
|
# lcls = k * CrossEntropyLoss(pred_cls[mask], torch.argmax(tcls, 1))
|
||||||
# lcls = k * BCEWithLogitsLoss(pred_cls[mask], tcls.float())
|
lcls = k * 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])
|
||||||
|
|
||||||
|
|
2
test.py
2
test.py
|
@ -7,7 +7,7 @@ parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-batch_size', type=int, default=32, help='size of each image batch')
|
parser.add_argument('-batch_size', type=int, default=32, help='size of each image batch')
|
||||||
parser.add_argument('-cfg', type=str, default='cfg/yolov3.cfg', help='path to model config file')
|
parser.add_argument('-cfg', type=str, default='cfg/yolov3.cfg', help='path to model config file')
|
||||||
parser.add_argument('-data_config_path', type=str, default='cfg/coco.data', help='path to data config file')
|
parser.add_argument('-data_config_path', type=str, default='cfg/coco.data', help='path to data config file')
|
||||||
parser.add_argument('-weights_path', type=str, default='checkpoints/yolov3.pt', help='path to weights file')
|
parser.add_argument('-weights_path', type=str, default='checkpoints/latest.pt', help='path to weights file')
|
||||||
parser.add_argument('-class_path', type=str, default='data/coco.names', help='path to class label file')
|
parser.add_argument('-class_path', type=str, default='data/coco.names', help='path to class label file')
|
||||||
parser.add_argument('-iou_thres', type=float, default=0.5, help='iou threshold required to qualify as detected')
|
parser.add_argument('-iou_thres', type=float, default=0.5, help='iou threshold required to qualify as detected')
|
||||||
parser.add_argument('-conf_thres', type=float, default=0.5, help='object confidence threshold')
|
parser.add_argument('-conf_thres', type=float, default=0.5, help='object confidence threshold')
|
||||||
|
|
|
@ -264,8 +264,8 @@ def build_targets(pred_boxes, pred_conf, pred_cls, target, anchor_wh, nA, nC, nG
|
||||||
ty[b, a, gj, gi] = gy - gj.float()
|
ty[b, a, gj, gi] = gy - gj.float()
|
||||||
|
|
||||||
# Width and height (yolo method)
|
# Width and height (yolo method)
|
||||||
tw[b, a, gj, gi] = torch.log(gw / anchor_wh[a, 0] + 1e-16)
|
tw[b, a, gj, gi] = torch.log(gw / anchor_wh[a, 0])
|
||||||
th[b, a, gj, gi] = torch.log(gh / anchor_wh[a, 1] + 1e-16)
|
th[b, a, gj, gi] = torch.log(gh / anchor_wh[a, 1])
|
||||||
|
|
||||||
# Width and height (power method)
|
# Width and height (power method)
|
||||||
# tw[b, a, gj, gi] = torch.sqrt(gw / anchor_wh[a, 0]) / 2
|
# tw[b, a, gj, gi] = torch.sqrt(gw / anchor_wh[a, 0]) / 2
|
||||||
|
|
Loading…
Reference in New Issue