Skip to content

hiseulgi/JSON2YOLO

 
 

Repository files navigation

Personal Notes (Usage)

Converts COCO JSON format to YOLO format.

This script provides a command-line interface for easy conversion.

Usage:

python coco2yolo.py --json_dir path/to/coco_json_files --use_segments

# For converting COCO classes from 91 to 80 categories:
python coco2yolo.py --json_dir path/to/coco_json_files --cls91to80

# For default behavior (no segmentation, 91 classes):
python coco2yolo.py --json_dir path/to/coco_json_files

Arguments:

  • --json_dir: (Optional) Path to the directory containing JSON annotation files (*.json). If not provided, assumes the default location of "coco/annotations".
  • --use_segments: (Optional) Flag to include segmentation information in the output (for COCO only). Defaults to False.
  • --cls91to80: (Optional) Flag to convert COCO classes from 91 to 80 categories (for COCO only). Defaults to False.


🚀 Introduction

Welcome to the COCO2YOLO repository! This toolkit is designed to help you convert datasets in JSON format, following the COCO (Common Objects in Context) standards, into YOLO (You Only Look Once) format, which is widely recognized for its efficiency in real-time object detection tasks.

This process is essential for machine learning practitioners looking to train object detection models using the Darknet framework. Our code is flexible and can be utilized across various platforms including Linux, MacOS, and Windows.

Ultralytics Actions

⚙️ Requirements

To get started with COCO2YOLO, you'll need a Python environment running version 3.8 or later. Additionally, you'll need to install all the necessary dependencies listed in our requirements.txt file. You can install these dependencies using the following pip command in your terminal:

$ pip install -r requirements.txt # Installs all the required packages

📚 Citation

If you find our tool useful for your research or development, please consider citing it:

DOI

🤝 Contribute

We welcome contributions from the community! Whether you're fixing bugs, adding new features, or improving documentation, your input is invaluable. Take a look at our Contributing Guide to get started. Also, we'd love to hear about your experience with Ultralytics products. Please consider filling out our Survey. A huge 🙏 and thank you to all of our contributors!

Ultralytics open-source contributors

©️ License

Ultralytics is excited to offer two different licensing options to meet your needs:

  • AGPL-3.0 License: Perfect for students and hobbyists, this OSI-approved open-source license encourages collaborative learning and knowledge sharing. Please refer to the LICENSE file for detailed terms.
  • Enterprise License: Ideal for commercial use, this license allows for the integration of Ultralytics software and AI models into commercial products without the open-source requirements of AGPL-3.0. For use cases that involve commercial applications, please contact us via Ultralytics Licensing.

📬 Contact Us

For bug reports, feature requests, and contributions, head to GitHub Issues. For questions and discussions about this project and other Ultralytics endeavors, join us on Discord!


Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics Instagram space Ultralytics Discord

About

Convert JSON annotations into YOLO format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%