Browse Source

gsutil cp yaml when evolving to GCP bucket

5.0
Glenn Jocher 4 years ago
parent
commit
f7e075fe93
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      utils/general.py

+ 3
- 4
utils/general.py View File

@@ -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])
@@ -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
@@ -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)


Loading…
Cancel
Save