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] 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()