glenn-jocher
commited on
Commit
•
4ca4aec
1
Parent(s):
7a39803
Do not save hyp.yaml and opt.yaml on evolve (#5775)
Browse files* Do not save hyp.yaml and opt.yaml on evolve
* Update general.py
- train.py +6 -5
- utils/general.py +1 -1
train.py
CHANGED
@@ -76,13 +76,14 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
|
|
76 |
LOGGER.info(colorstr('hyperparameters: ') + ', '.join(f'{k}={v}' for k, v in hyp.items()))
|
77 |
|
78 |
# Save run settings
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
|
85 |
# Loggers
|
|
|
86 |
if RANK in [-1, 0]:
|
87 |
loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance
|
88 |
if loggers.wandb:
|
|
|
76 |
LOGGER.info(colorstr('hyperparameters: ') + ', '.join(f'{k}={v}' for k, v in hyp.items()))
|
77 |
|
78 |
# Save run settings
|
79 |
+
if not evolve:
|
80 |
+
with open(save_dir / 'hyp.yaml', 'w') as f:
|
81 |
+
yaml.safe_dump(hyp, f, sort_keys=False)
|
82 |
+
with open(save_dir / 'opt.yaml', 'w') as f:
|
83 |
+
yaml.safe_dump(vars(opt), f, sort_keys=False)
|
84 |
|
85 |
# Loggers
|
86 |
+
data_dict = None
|
87 |
if RANK in [-1, 0]:
|
88 |
loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance
|
89 |
if loggers.wandb:
|
utils/general.py
CHANGED
@@ -777,7 +777,7 @@ def print_mutation(results, hyp, save_dir, bucket):
|
|
777 |
i = np.argmax(fitness(data.values[:, :7])) #
|
778 |
f.write('# YOLOv5 Hyperparameter Evolution Results\n' +
|
779 |
f'# Best generation: {i}\n' +
|
780 |
-
f'# Last generation: {len(data)}\n' +
|
781 |
'# ' + ', '.join(f'{x.strip():>20s}' for x in keys[:7]) + '\n' +
|
782 |
'# ' + ', '.join(f'{x:>20.5g}' for x in data.values[i, :7]) + '\n\n')
|
783 |
yaml.safe_dump(hyp, f, sort_keys=False)
|
|
|
777 |
i = np.argmax(fitness(data.values[:, :7])) #
|
778 |
f.write('# YOLOv5 Hyperparameter Evolution Results\n' +
|
779 |
f'# Best generation: {i}\n' +
|
780 |
+
f'# Last generation: {len(data) - 1}\n' +
|
781 |
'# ' + ', '.join(f'{x.strip():>20s}' for x in keys[:7]) + '\n' +
|
782 |
'# ' + ', '.join(f'{x:>20.5g}' for x in data.values[i, :7]) + '\n\n')
|
783 |
yaml.safe_dump(hyp, f, sort_keys=False)
|