Skip to content

Commit

Permalink
fix visual export for windows (#335)
Browse files Browse the repository at this point in the history
* fix single image source export

* fix a bug in image dir source for windows
  • Loading branch information
fcakyon authored Jan 6, 2022
1 parent 5a4b9ca commit b88aef5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sahi/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b88aef5

Please sign in to comment.