JSON2YOLO
Convert JSON annotations into YOLO format.
Install / Use
/learn @ultralytics/JSON2YOLOREADME
<a href="https://www.ultralytics.com/"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
🚀 Introduction
Welcome to the JSON2YOLO repository! This toolkit is designed to help you convert datasets in JSON format, particularly those following the COCO (Common Objects in Context) standards, into the YOLO format. The YOLO format is widely recognized for its efficiency in real-time object detection tasks.
This conversion process is essential for machine learning practitioners looking to train object detection models using frameworks compatible with the YOLO format, such as Ultralytics YOLO. Our code is flexible and designed to run across various platforms including Linux, macOS, and Windows.
📢 Important Update: The JSON2YOLO project is now integrated into the main Ultralytics package at https://github.com/ultralytics/ultralytics. The standalone scripts in this repository are no longer being actively updated. For the latest functionality, please use the new
convert_coco()method described in our updated data converter documentation.
⚙️ Requirements
To get started with JSON2YOLO, you'll need a Python environment running version 3.8 or later. Additionally, you'll need to install all the necessary dependencies listed in the 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
💡 Usage
JSON2YOLO functionality is now part of the main ultralytics Python package. To use the converter, first install the package:
pip install ultralytics
You can then easily convert COCO JSON datasets to YOLO format using the convert_coco method. Here's an example using keypoint annotations:
from ultralytics.data.converter import convert_coco
convert_coco(
labels_dir="path/to/labels.json",
save_dir="path/to/output_dir",
use_keypoints=True,
)
This method processes your JSON file, converts annotations (bounding boxes and keypoints), and saves the labels in YOLO format (.txt files) within the specified directory. For more details, refer to our dataset format documentation.
📚 Citation
If you find our tool useful for your research or development, please consider citing it:
🤝 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!
©️ License
Ultralytics offers two licensing options to accommodate diverse needs:
- AGPL-3.0 License: Ideal for students and enthusiasts, this OSI-approved open-source license promotes collaboration and knowledge sharing. See the LICENSE file for details.
- Enterprise License: Designed for commercial use, this license permits seamless integration of Ultralytics software and AI models into commercial products and services, bypassing the open-source requirements of AGPL-3.0. For commercial inquiries, please contact us through Ultralytics Licensing.
📬 Contact Us
For bug reports, feature requests, and contributions, please visit GitHub Issues. For broader questions and discussions about this project and other Ultralytics initiatives, join our vibrant community on Discord!
<br> <div align="center"> <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space"> <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space"> <a href="https://twitter.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space"> <a href="https://youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space"> <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space"> <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a> <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space"> <a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a> </div>Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

