Skip to content

Commit

Permalink
Slicing: add unique slice index number to output file name (#943)
Browse files Browse the repository at this point in the history
Co-authored-by: jokober <glpat-xy-QA7sDBF1125TDuaBe>
Co-authored-by: fatih <[email protected]>
  • Loading branch information
jokober and fcakyon authored Nov 5, 2023
1 parent 5e36667 commit f04a7ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sahi/slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def slice_coco(
sliced_coco_images: List = []

# iterate over images and slice
for coco_image in tqdm(coco.images):
for idx, coco_image in enumerate(tqdm(coco.images)):
# get image path
image_path: str = os.path.join(image_dir, coco_image.file_name)
# get annotation json list corresponding to selected coco image
Expand All @@ -478,7 +478,7 @@ def slice_coco(
slice_image_result = slice_image(
image=image_path,
coco_annotation_list=coco_image.annotations,
output_file_name=Path(coco_image.file_name).stem,
output_file_name=f"{Path(coco_image.file_name).stem}_{idx}",
output_dir=output_dir,
slice_height=slice_height,
slice_width=slice_width,
Expand Down

0 comments on commit f04a7ee

Please sign in to comment.