Coder Social home page Coder Social logo

yolo-to-coco-format-converter's Introduction

Yolo-to-COCO-format-converter

When you use Yolo-model, you might create annotation labels with 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! ๐Ÿ˜ฅ

This code will help you make a COCO format annotations with Yolo format!

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.

2. Check the absolute path in train.txt.

Make sure that it points to the absolute path to the folder where the image and text files are located.
You can easily change the path with Text Editor(Ubuntu 18.04) or NotePad (Window 10).

3. Just run the code.

You need to provide 2 argments(essential) & 1 argments(optional).

  • path : Absolute path of train.txt
  • output : Name of the json file
  • debug : If you want to check the bounding boxes or annotation information.

When you want to make json file,

  • python main.py --path [Absolute Path of train.txt] --output [Name of the json file]
  • (For example)python main.py --path /home/taeyoungkim/Desktop/Yolo-to-COCO-format-converter/tutorial/train.txt --output train

Or when you want to check the bounding boxes,

  • python main.py --path [Absolute Path of train.txt] --output [Name of the json file] --debug
  • (For example)python main.py --path /home/taeyoungkim/Desktop/Yolo-to-COCO-format-converter/tutorial/train.txt --output train --debug

Tips

If you want to read json files more clearly, you should use JQ!

  • JQ Manual
  • (For example) cd output
  • jq . train.json > train_jq.json

Results

Result of Json file

On debug mode, you can check bounding boxes

On debug mode, you can check annotation information on terminal

Contributors

yolo-to-coco-format-converter's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.