diff --git a/train.py b/train.py index 3142781..75cbea6 100644 --- a/train.py +++ b/train.py @@ -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 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)) dist.destroy_process_group() if torch.cuda.device_count() > 1 else None torch.cuda.empty_cache() diff --git a/utils/utils.py b/utils/utils.py index fb8d487..df69c1a 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -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) -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 fig, ax = plt.subplots(2, 5, figsize=(12, 6)) 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') files = ['https://storage.googleapis.com/%s/results%g.txt' % (bucket, x) for x in id] 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): try: results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T