Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 1.44 KB

File metadata and controls

28 lines (24 loc) · 1.44 KB

Coco to Yolo format conversion

This code is used to convert a dataset in COCO format to a dataset in Yolo format which can be used to train a YoloV5 model.

Setup

Install the dependencies with pipenv: pipenv install and activate the environment: pipenv shell.

Usage

Use:

python src/sbb2yolo.py --coco-input-folders PATH_TO_COCO_INPUT_FOLDER1 PATH_TO_COCO_INPUT_FOLDER2 \
 --yolo-output-folder PATH_TO_OUTPUT_FOLDER \
 --yolo-config-file CONFIG_FILE_NAME \
 --dataset-split-pivot RATIO_TRAIN_TO_VAL
  • The conversion script takes the Coco input folders (folder containing all images as well as an annotation file). Several Coco datasets can be specified, in which case the script combines all the datasets.
  • It creates a datast in Yolo format in PATH_TO_OUTPUT_FOLDER. This dataset contains the configuration file, as well as an images and labels folder
  • The name of the YAML config file can be changed (--yolo-config-file)
  • The proportion of the data to use for test is specified with --dataset-split-pivot, e.g. 0.8 means 80% for the training set and the remaining 20% for the validation set.

Tests

In order to run the tests, use:

pytest

Authors

  • Stefan Aebischer
  • Jeanne Fleury