Add plot_results save location to log_dir

pull/1/head
Alex Stoken 5 years ago
parent c8152c81a6
commit e572bb0803

@ -356,7 +356,7 @@ def train(hyp):
os.system('gsutil cp %s gs://%s/weights' % (f2, opt.bucket)) if opt.bucket and ispt else None # upload os.system('gsutil cp %s gs://%s/weights' % (f2, opt.bucket)) if opt.bucket and ispt else None # upload
if not opt.evolve: if not opt.evolve:
plot_results() # save as results.png plot_results(save_dir = log_dir) # save as results.png
print('%g epochs completed in %.3f hours.\n' % (epoch - start_epoch + 1, (time.time() - t0) / 3600)) print('%g epochs completed in %.3f hours.\n' % (epoch - start_epoch + 1, (time.time() - t0) / 3600))
dist.destroy_process_group() if torch.cuda.device_count() > 1 else None dist.destroy_process_group() if torch.cuda.device_count() > 1 else None
torch.cuda.empty_cache() torch.cuda.empty_cache()

@ -1154,7 +1154,7 @@ def plot_results_overlay(start=0, stop=0): # from utils.utils import *; plot_re
fig.savefig(f.replace('.txt', '.png'), dpi=200) fig.savefig(f.replace('.txt', '.png'), dpi=200)
def plot_results(start=0, stop=0, bucket='', id=(), labels=()): # from utils.utils import *; plot_results() def plot_results(start=0, stop=0, bucket='', id=(), labels=(), save_dir= '.'): # from utils.utils import *; plot_results()
# Plot training 'results*.txt' as seen in https://github.com/ultralytics/yolov5#reproduce-our-training # Plot training 'results*.txt' as seen in https://github.com/ultralytics/yolov5#reproduce-our-training
fig, ax = plt.subplots(2, 5, figsize=(12, 6)) fig, ax = plt.subplots(2, 5, figsize=(12, 6))
ax = ax.ravel() ax = ax.ravel()
@ -1164,7 +1164,7 @@ def plot_results(start=0, stop=0, bucket='', id=(), labels=()): # from utils.ut
os.system('rm -rf storage.googleapis.com') os.system('rm -rf storage.googleapis.com')
files = ['https://storage.googleapis.com/%s/results%g.txt' % (bucket, x) for x in id] files = ['https://storage.googleapis.com/%s/results%g.txt' % (bucket, x) for x in id]
else: else:
files = glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt') files = glob.glob(os.path.join(save_dir,'results*.txt')) + glob.glob('../../Downloads/results*.txt')
for fi, f in enumerate(files): for fi, f in enumerate(files):
try: try:
results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T

Loading…
Cancel
Save