# Yolo-to-COCO-format-converter **Repository Path**: ccoding2021/Yolo-to-COCO-format-converter ## Basic Information - **Project Name**: Yolo-to-COCO-format-converter - **Description**: YOLO2COCO format - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-30 - **Last Updated**: 2021-11-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Yolo-to-COCO-format-converter When you use **Yolo-model**, you might create annotation labels with [Yolo-mark](https://github.com/AlexeyAB/Yolo_mark). For example, - `obj.names` - example of list with object names - `train.txt` - example with list of image filenames for training Yolo model - `train/` - example of folder that contain images and labels > - *.jpg : example of list of image > - *.txt : example of list of label **But, when you want to use another model(ex. efficientdet), you need another annotation format! :disappointed_relieved:** ### This code will help you make a COCO format annotations with Yolo format! ### Updates - Oct 13th, 2021 - We could support not only **`Yolo-mark`** outputs, but also **`OpenLabeling`** outputs! Also, We could make segmentation mask polygons information in json file. Thanks to [@NauchtanRobotics](https://github.com/NauchtanRobotics)! ## How to use ### Requirements - numpy - OpenCV You can make same environment with anaconda environment. - `conda create -n Yolo-to-COCO python=3.8` - `conda activate Yolo-to-COCO` - `pip install numpy` - `pip install opencv` Just clone this repository. - `git clone https://github.com/Taeyoung96/Yolo-to-COCO-format-converter.git` - `cd Yolo-to-COCO-format-converter` ### It will be easy to understand if you refer to the tutorial folder. When you have your own Yolo annotation format, just change a little bit! ### 1. Change `classes` with your own dataset. In `main.py`, there is a code that declare the classes. You will change this with your `obj.names`.
dataset_root_dir/ Photo_00001.jpg Photo_00001.txt Photo_00002.jpg Photo_00003.txtYou don't need to specify `yolo-subdir` argument. - `python main.py --path
dataset_root_dir/ YOLO_darknet/ Photo_00001.txt Photo_00002.txt Photo_00001.jpg Photo_00002.jpgCommand to use: - `python main.py --yolo-subdir --path
Result of Json file
On debug mode, you can check bounding boxes
On debug mode, you can check annotation information on terminal
## Contributors - I created a repository by referring to [chrise96/image-to-coco-json-converter](https://github.com/chrise96/image-to-coco-json-converter). - **GeeJae Lee** helped to make it. ## License ``` Copyright (c) 2021 Tae Young Kim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```