From 56535badc8cd6ce0ce328d4d7c3d71fafe617c37 Mon Sep 17 00:00:00 2001 From: ys31jp <83806490+ys31jp@users.noreply.github.com> Date: Fri, 5 Nov 2021 19:51:45 +0800 Subject: [PATCH 1/2] Update plots.py Error running python detect.py --visualize #5503 --- utils/plots.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index 94487b4f5b85..4ca3462cab98 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -443,5 +443,7 @@ def feature_visualization(x, module_type, stage, n=32, save_dir=Path('runs/detec ax[i].axis('off') print(f'Saving {save_dir / f}... ({n}/{channels})') - plt.savefig(save_dir / f, dpi=300, bbox_inches='tight') + if not os.path.exists(save_dir): + os.makedirs(save_dir) + plt.savefig('{}/{}.png'.format(save_dir, f), dpi=300, bbox_inches='tight') plt.close() From fc201066cfbcd168fdb8d02dc00042fe7a7dd43c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 5 Nov 2021 13:07:56 +0100 Subject: [PATCH 2/2] Update plots.py --- utils/plots.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/utils/plots.py b/utils/plots.py index 4ca3462cab98..94487b4f5b85 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -443,7 +443,5 @@ def feature_visualization(x, module_type, stage, n=32, save_dir=Path('runs/detec ax[i].axis('off') print(f'Saving {save_dir / f}... ({n}/{channels})') - if not os.path.exists(save_dir): - os.makedirs(save_dir) - plt.savefig('{}/{}.png'.format(save_dir, f), dpi=300, bbox_inches='tight') + plt.savefig(save_dir / f, dpi=300, bbox_inches='tight') plt.close()