This commit is contained in:
552068321@qq.com 2022-11-08 09:10:02 +08:00
parent 9e5134628e
commit e994b2ff20

View File

@ -106,7 +106,7 @@ def train(hyp, opt, device, data_list,id,callbacks): # hyp is path/to/hyp.yaml
(wd.parent if evolve else wd).mkdir(parents=True, exist_ok=True) # make dir
# 获取版本号,项目名称
#version, pro_name = get_version_name(pro)
best = opt.savemodel#w + pro_name + '_' + 'R-ODY' + version + '.pt'
best = Path(opt.savemodel)#w + pro_name + '_' + 'R-ODY' + version + '.pt'
#last, best = w / 'last.pt', w / 'best.pt'
# Hyperparameters
@ -468,7 +468,7 @@ def train(hyp, opt, device, data_list,id,callbacks): # hyp is path/to/hyp.yaml
if RANK in {-1, 0}:
LOGGER.info(f'\n{epoch - start_epoch + 1} epochs completed in {(time.time() - t0) / 3600:.3f} hours.')
for f in best:
if f.exists():
if os.path.exists(f):
strip_optimizer(f) # strip optimizers
if f is best:
LOGGER.info(f'\nValidating {f}...')