提交 f7e075fe authored 作者: Glenn Jocher's avatar Glenn Jocher

gsutil cp yaml when evolving to GCP bucket

上级 9dbaa1bb
...@@ -866,9 +866,6 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''): ...@@ -866,9 +866,6 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''):
x = x[np.argsort(-fitness(x))] # sort x = x[np.argsort(-fitness(x))] # sort
np.savetxt('evolve.txt', x, '%10.3g') # save sort by fitness np.savetxt('evolve.txt', x, '%10.3g') # save sort by fitness
if bucket:
os.system('gsutil cp evolve.txt gs://%s' % bucket) # upload evolve.txt
# Save yaml # Save yaml
for i, k in enumerate(hyp.keys()): for i, k in enumerate(hyp.keys()):
hyp[k] = float(x[0, i + 7]) hyp[k] = float(x[0, i + 7])
...@@ -878,6 +875,9 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''): ...@@ -878,6 +875,9 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''):
f.write('# Hyperparameter Evolution Results\n# Generations: %g\n# Metrics: ' % len(x) + c + '\n\n') f.write('# Hyperparameter Evolution Results\n# Generations: %g\n# Metrics: ' % len(x) + c + '\n\n')
yaml.dump(hyp, f, sort_keys=False) yaml.dump(hyp, f, sort_keys=False)
if bucket:
os.system('gsutil cp evolve.txt %s gs://%s' % (yaml_file, bucket)) # upload
def apply_classifier(x, model, img, im0): def apply_classifier(x, model, img, im0):
# applies a second stage classifier to yolo outputs # applies a second stage classifier to yolo outputs
...@@ -1273,4 +1273,3 @@ def plot_results(start=0, stop=0, bucket='', id=(), labels=(), ...@@ -1273,4 +1273,3 @@ def plot_results(start=0, stop=0, bucket='', id=(), labels=(),
fig.tight_layout() fig.tight_layout()
ax[1].legend() ax[1].legend()
fig.savefig(Path(save_dir) / 'results.png', dpi=200) fig.savefig(Path(save_dir) / 'results.png', dpi=200)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论