Unverified 提交 4ca4aec4 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Do not save hyp.yaml and opt.yaml on evolve (#5775)

* Do not save hyp.yaml and opt.yaml on evolve * Update general.py
上级 7a398034
...@@ -76,13 +76,14 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary ...@@ -76,13 +76,14 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
LOGGER.info(colorstr('hyperparameters: ') + ', '.join(f'{k}={v}' for k, v in hyp.items())) LOGGER.info(colorstr('hyperparameters: ') + ', '.join(f'{k}={v}' for k, v in hyp.items()))
# Save run settings # Save run settings
with open(save_dir / 'hyp.yaml', 'w') as f: if not evolve:
yaml.safe_dump(hyp, f, sort_keys=False) with open(save_dir / 'hyp.yaml', 'w') as f:
with open(save_dir / 'opt.yaml', 'w') as f: yaml.safe_dump(hyp, f, sort_keys=False)
yaml.safe_dump(vars(opt), f, sort_keys=False) with open(save_dir / 'opt.yaml', 'w') as f:
data_dict = None yaml.safe_dump(vars(opt), f, sort_keys=False)
# Loggers # Loggers
data_dict = None
if RANK in [-1, 0]: if RANK in [-1, 0]:
loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance
if loggers.wandb: if loggers.wandb:
......
...@@ -777,7 +777,7 @@ def print_mutation(results, hyp, save_dir, bucket): ...@@ -777,7 +777,7 @@ def print_mutation(results, hyp, save_dir, bucket):
i = np.argmax(fitness(data.values[:, :7])) # i = np.argmax(fitness(data.values[:, :7])) #
f.write('# YOLOv5 Hyperparameter Evolution Results\n' + f.write('# YOLOv5 Hyperparameter Evolution Results\n' +
f'# Best generation: {i}\n' + f'# Best generation: {i}\n' +
f'# Last generation: {len(data)}\n' + f'# Last generation: {len(data) - 1}\n' +
'# ' + ', '.join(f'{x.strip():>20s}' for x in keys[:7]) + '\n' + '# ' + ', '.join(f'{x.strip():>20s}' for x in keys[:7]) + '\n' +
'# ' + ', '.join(f'{x:>20.5g}' for x in data.values[i, :7]) + '\n\n') '# ' + ', '.join(f'{x:>20.5g}' for x in data.values[i, :7]) + '\n\n')
yaml.safe_dump(hyp, f, sort_keys=False) yaml.safe_dump(hyp, f, sort_keys=False)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论