From 432dc28557f1ebdbbd68c0ab954faf4c9bf7ac81 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:05:05 +0900 Subject: [PATCH] save heatmap to subfolder --- scripts/daam_script.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/daam_script.py b/scripts/daam_script.py index bc5269b..5dfefbe 100644 --- a/scripts/daam_script.py +++ b/scripts/daam_script.py @@ -288,7 +288,9 @@ def before_image_saved(self, params : script_callbacks.ImageSaveParams): img : Image.Image = utils.image_overlay_heat_map(params.image, heat_map_img, alpha=self.alpha, caption=caption, image_scale=self.heatmap_image_scale) fullfn_without_extension, extension = os.path.splitext(params.filename) - full_filename = fullfn_without_extension + "_" + attention + ("_" + self.attn_captions[i] if self.attn_captions[i] else "") + extension + if not os.path.exists(fullfn_without_extension): + os.makedirs(fullfn_without_extension) + full_filename = fullfn_without_extension + "/" + attention + ("_" + self.attn_captions[i] if self.attn_captions[i] else "") + extension if self.use_grid: heatmap_images.append(img)