glenn-jocher commited on
Commit
f7e075f
1 Parent(s): 9dbaa1b

gsutil cp yaml when evolving to GCP bucket

Browse files
Files changed (1) hide show
  1. utils/general.py +3 -4
utils/general.py CHANGED
@@ -866,9 +866,6 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''):
866
  x = x[np.argsort(-fitness(x))] # sort
867
  np.savetxt('evolve.txt', x, '%10.3g') # save sort by fitness
868
 
869
- if bucket:
870
- os.system('gsutil cp evolve.txt gs://%s' % bucket) # upload evolve.txt
871
-
872
  # Save yaml
873
  for i, k in enumerate(hyp.keys()):
874
  hyp[k] = float(x[0, i + 7])
@@ -878,6 +875,9 @@ def print_mutation(hyp, results, yaml_file='hyp_evolved.yaml', bucket=''):
878
  f.write('# Hyperparameter Evolution Results\n# Generations: %g\n# Metrics: ' % len(x) + c + '\n\n')
879
  yaml.dump(hyp, f, sort_keys=False)
880
 
 
 
 
881
 
882
  def apply_classifier(x, model, img, im0):
883
  # applies a second stage classifier to yolo outputs
@@ -1273,4 +1273,3 @@ def plot_results(start=0, stop=0, bucket='', id=(), labels=(),
1273
  fig.tight_layout()
1274
  ax[1].legend()
1275
  fig.savefig(Path(save_dir) / 'results.png', dpi=200)
1276
-
 
866
  x = x[np.argsort(-fitness(x))] # sort
867
  np.savetxt('evolve.txt', x, '%10.3g') # save sort by fitness
868
 
 
 
 
869
  # Save yaml
870
  for i, k in enumerate(hyp.keys()):
871
  hyp[k] = float(x[0, i + 7])
 
875
  f.write('# Hyperparameter Evolution Results\n# Generations: %g\n# Metrics: ' % len(x) + c + '\n\n')
876
  yaml.dump(hyp, f, sort_keys=False)
877
 
878
+ if bucket:
879
+ os.system('gsutil cp evolve.txt %s gs://%s' % (yaml_file, bucket)) # upload
880
+
881
 
882
  def apply_classifier(x, model, img, im0):
883
  # applies a second stage classifier to yolo outputs
 
1273
  fig.tight_layout()
1274
  ax[1].legend()
1275
  fig.savefig(Path(save_dir) / 'results.png', dpi=200)