Browse Source

Remove --resume functionality and related checks/logic.

5.0
Alex Stoken 4 years ago
parent
commit
d64ad0fbf3
2 changed files with 19 additions and 21 deletions
  1. +18
    -0
      equip_hyp.yaml
  2. +1
    -21
      train.py

+ 18
- 0
equip_hyp.yaml View File

@@ -0,0 +1,18 @@
anchor_t: 4.0
cls: 0.58
cls_pw: 1.0
degrees: 0.0
fl_gamma: 0.0
giou: 0.05
hsv_h: 0.014
hsv_s: 0.68
hsv_v: 0.36
iou_t: 0.2
lr0: 0.001
momentum: 0.90
obj: 1.0
obj_pw: 1.0
scale: 0.5
shear: 5
translate: 0.05
weight_decay: 0.0005

+ 1
- 21
train.py View File

@@ -372,8 +372,6 @@ if __name__ == '__main__':
parser.add_argument('--data', type=str, default='data/coco128.yaml', help='*.data path')
parser.add_argument('--img-size', nargs='+', type=int, default=[640, 640], help='train,test sizes. Assumes square imgs.')
parser.add_argument('--rect', action='store_true', help='rectangular training')
parser.add_argument('--resume', action='store_true', help='resume training from last.pt')
parser.add_argument('--resume-from-run', type=str, default='', help='resume training from last.pt in this dir')
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
parser.add_argument('--notest', action='store_true', help='only test final epoch')
parser.add_argument('--evolve', action='store_true', help='evolve hyperparameters')
@@ -385,27 +383,9 @@ if __name__ == '__main__':
parser.add_argument('--adam', action='store_true', help='use adam optimizer')
parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%')
parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset')
parser.add_argument('--hyp', type=str, default='', help ='path to hyp yaml file. Not needed with --resume.')
parser.add_argument('--hyp', type=str, default='', help ='path to hyp yaml file.')
opt = parser.parse_args()

# logic to resume from latest run if either --resume or --resume-from-run is selected
# Note if neither --resume or --resume-from-run, last is set to empty string
if opt.resume_from_run:
opt.resume = True
last = opt.resume_from_run
elif opt.resume and not opt.resume_from_run:
last = get_latest_run()
print(f'WARNING: No run provided to resume from. Resuming from most recent run found at {last}')
else:
last = ''

# if resuming, check for hyp file
if last:
last_hyp = last.replace('last.pt', 'hyp.yaml')
if os.path.exists(last_hyp):
opt.hyp = last_hyp

opt.weights = last if opt.resume else opt.weights
opt.cfg = check_file(opt.cfg) # check file
opt.data = check_file(opt.data) # check file
opt.hyp = check_file(opt.hyp) if opt.hyp else '' #check file

Loading…
Cancel
Save