From b88aef5f0b3af07b84827c53b0f54acb52242112 Mon Sep 17 00:00:00 2001 From: fatih <34196005+fcakyon@users.noreply.github.com> Date: Thu, 6 Jan 2022 14:04:26 +0300 Subject: [PATCH] fix visual export for windows (#335) * fix single image source export * fix a bug in image dir source for windows --- sahi/predict.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sahi/predict.py b/sahi/predict.py index 5ecbb1934..590eaf0f7 100644 --- a/sahi/predict.py +++ b/sahi/predict.py @@ -449,10 +449,10 @@ def predict( for ind, image_path in enumerate(tqdm(image_path_list, "Performing inference on images")): # get filename if os.path.isdir(source): # preserve source folder structure in export - relative_filepath = image_path.split(source)[-1] + relative_filepath = str(Path(image_path)).split(str(Path(source)))[-1] relative_filepath = relative_filepath[1:] if relative_filepath[0] == os.sep else relative_filepath else: # no process if source is single file - relative_filepath = image_path + relative_filepath = Path(image_path).name filename_without_extension = Path(relative_filepath).stem # load image image_as_pil = read_image_as_pil(image_path)