From 7362cdcbba328fee0e92e13eb8352c0436ee7ea9 Mon Sep 17 00:00:00 2001 From: Alexander Riedel <54716527+alexriedel1@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:31:47 +0200 Subject: [PATCH] last two parts of file path for image saving --- src/anomalib/data/utils/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/anomalib/data/utils/image.py b/src/anomalib/data/utils/image.py index 64a27724cc..85d2cfe2df 100644 --- a/src/anomalib/data/utils/image.py +++ b/src/anomalib/data/utils/image.py @@ -440,7 +440,7 @@ def save_image(filename: Path | str, image: np.ndarray | Figure, root: Path | No # if file_path is absolute, then root is ignored # so we remove the top level directory from the path if file_path.is_absolute() and root: - file_path = Path(*file_path.parts[2:]) # OS-AGNOSTIC + file_path = Path(*file_path.parts[-2:]) # OS-AGNOSTIC if root: file_path = root / file_path