supervision: "Killed" during dataset convert from COCO to YOLO format

Search before asking

  • I have searched the Supervision issues and found no similar bug report.

Bug

getting “Killed” error while converting dataset from coco to yolo (the code is given bellow):

Screenshot from 2023-08-04 16-02-16

i tried to split manually big dataset in smaller parts (3 parts) and then didn’t get error, but in .YAML file i got different classes positions in “names” part

names: [truck, car, medium car, bus, motorcycle]

and

names: [bus, car, medium car, truck, motorcycle]

any suggestions? Thank you in advance!

Environment

  • python 3.9.13
  • Ubuntu 20.04
  • supervision 0.12.0

Minimal Reproducible Example

import supervision as sv

ds = sv.DetectionDataset.from_coco(
    images_directory_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/all_dataset',
    annotations_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/all_dataset.json',
    force_masks=True
)

train_ds, test_ds = ds.split(split_ratio=0.8, random_state=42, shuffle=True)

train_ds.as_yolo(
    images_directory_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/all_yolo/train/images',
    annotations_directory_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/all_yolo/train_/labels',
    data_yaml_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/train_copy_parts/data_train.yaml'

)

test_ds.as_yolo(
    images_directory_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/all_yolo/test/images',
    annotations_directory_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/all_yolo/test/labels',
    data_yaml_path='/home/droneteam/detectron2_for_labeling/codes_for_testing_seg_model/500_datasetas_pirmam_mokymui/train_copy_parts/data_test.yaml'

)

Additional

No response

Are you willing to submit a PR?

  • Yes I’d like to help by submitting a PR!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

@DovydasPociusDroneTeam 🔥 Awesome that we managed to get to the bottom of this problem.

Looking forward to converting the full dataset without needing to split it into separate parts!

We will need to introduce lazy loading of images to make that happen. It is on our roadmap. I’ll pin this issue there to keep track of that problem.

I’ll close the issue for now.

Hi @Killua7362, there is already the issue and PR, but I didn’t have time to review it yet.