Skip to content

Commit

Permalink
gsutil cp yaml when evolving to GCP bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Aug 22, 2020
1 parent 9dbaa1b commit f7e075f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,9 +866,6 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''):
x = x[np.argsort(-fitness(x))] # sort
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
for i, k in enumerate(hyp.keys()):
hyp[k] = float(x[0, i + 7])
Expand All @@ -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')
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):
# applies a second stage classifier to yolo outputs
Expand Down Expand Up @@ -1273,4 +1273,3 @@ def plot_results(start=0, stop=0, bucket='', id=(), labels=(),
fig.tight_layout()
ax[1].legend()
fig.savefig(Path(save_dir) / 'results.png', dpi=200)

0 comments on commit f7e075f

Please sign in to comment.