If you have ever downloaded a public dataset to play with YOLO but found that the labels come in a different format, such as CVAT, COCO or PASCAL-VOC, I have created this script to make the conversion task easier.
I have tried to make it as modular as possible so that it can be integrated in other projects.
I hope you find it useful.
cd label-format-converter
python3 -m pip install -r requeriments.txt
Convert labels to YOLO format.
- Place your labels into the correct folder.
- CVAT: ~/label-format-converter/labels/cvat/*.xml
- COCO: ~/label-format-converter/labels/coco/*.json
- PASCAL: ~/label-format-converter/label/Annotations/*.xml
- (CVAT/COCO) Rename labels file.
- CVAT: annotations.xml
- COCO: instances_default.xml
- Update res/classes.json with the classes of the dataset
- Launch de main script with the origin format label as argument.
cd label-format-converter
python3 main.py [-f --format] [cvat, coco, pascal]
- Yolo folder will be created and the new labels will be placed in the next directory: ~/label-format-converter/labels/yolo
Code with 💛 by Adrián Rodríguez Galisteo
-
Github: https://github.com/adrirg9412/
-
LinkedIn: https://www.linkedin.com/in/adrian-rodriguez-galisteo/
-
Mail: [email protected]