--- tags: - slicing - api-reference - coco - dataset - small-object-detection --- # Slicing ## Slicing ::: sahi.slicing ### Slicing Utilities - Slice an image: ```python from sahi.slicing import slice_image slice_image_result = slice_image( image=image_path, output_file_name=output_file_name, output_dir=output_dir, slice_height=256, slice_width=256, overlap_height_ratio=0.2, overlap_width_ratio=0.2, ) ``` - Slice a COCO formatted dataset: ```python from sahi.slicing import slice_coco coco_dict, coco_path = slice_coco( coco_annotation_file_path=coco_annotation_file_path, image_dir=image_dir, slice_height=256, slice_width=256, overlap_height_ratio=0.2, overlap_width_ratio=0.2, ) ``` ### Interactive Demo Want to experiment with different slicing parameters and see their effects? Check out our [interactive notebooks](notebooks.md) for hands-on examples.