gsutil cp yaml when evolving to GCP bucket
This commit is contained in:
1 parent
9dbaa1bbbe
commit
f7e075fe93
1 file changed
+3
-4
+3
-4
@@ -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=''):
|
|||||||
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=(),
|
|||||||
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)
|
||||||
|
|
||||||
Reference in new issue
Block a user