Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 933 Bytes

File metadata and controls

52 lines (40 loc) · 933 Bytes
tags
slicing
api-reference
coco
dataset
small-object-detection

Slicing

Slicing

::: sahi.slicing

Slicing Utilities

  • Slice an image:
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:
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 for hands-on examples.