Skip to content

Perform slicing yolo format #755

Answered by fcakyon
CesareDavidePace asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @CesareDavidePace. You have to convert your dataset into coco format, then slice the dataset using sahi, then convert the sliced dataset into yolov5 format.

  1. You can use fiftyone to convert yolov5 dataset into coco format.

  2. Then you can use this snippet to slice your 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=512,
    slice_width=512,
    overlap_height_ratio=0.2,
    overlap_width_ratio=0.2,
)
  1. Then you can use this snippet to convert coco formatted dataset into yolov5 format:
from sahi.utils.coco import Coco, export_coco_as_yolov5

# init Co…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by fcakyon
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants