sahi icon indicating copy to clipboard operation
sahi copied to clipboard

Image slicing creates some wrong segmentations

Open s-fx opened this issue 2 years ago • 2 comments

Hi, I'm working on a ML segmentation project with high resolution images. I sliced the images into small patches of 256x256 Pixels and the COCO format Json file respectively (containing bboxes and segmentations).

coco_dict, coco_path = slice_coco(
         coco_annotation_file_path=json_file_dir,
         image_dir=img_dir,
         output_coco_annotation_file_name=root_dir + "sliced_annotations",
         output_dir=root_dir + dir_,
         slice_height=img_height,
         slice_width=img_width,
         overlap_height_ratio=0.2,
         overlap_width_ratio=0.2,
         min_area_ratio=0.1,
         verbose=False,
     )

But when I visualize the end results (with fiftyone) some of my segmentations are now just "filled bounding boxes" and some of the segmentations are correctly sliced. Unfortunately I can not share the images, but I am wondering why some of my segmentations are now just in the shape of a bounding box.

While slicing I encounter this Error message:

ERROR - shapely.geos -   TopologyException: Input geom 0 is invalid: Ring Self-intersection at 3201 1619
09/02/2022 15:50:43 - INFO - shapely.geos -   Ring Self-intersection at or near point 3201 1619

Could this be the cause because of polygons intersecting?

=> sahi 0.10.4

kind regards

s-fx avatar Aug 31 '22 09:08 s-fx