Skip to content

Commit f608d49

Browse files
authored
Merge branch 'main' into glenn-jocher-patch-1
Signed-off-by: Glenn Jocher <[email protected]>
2 parents 4be14ec + 0212231 commit f608d49

File tree

5 files changed

+58
-32
lines changed

5 files changed

+58
-32
lines changed

.github/workflows/format.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Ultralytics 🚀 - AGPL-3.0 License https://ultralytics.com/license
1+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2+
23
# Ultralytics Actions https://github.com/ultralytics/actions
3-
# This workflow automatically formats code and documentation in PRs to official Ultralytics standards
4+
# This workflow formats code and documentation in PRs to Ultralytics standards
45

56
name: Ultralytics Actions
67

@@ -11,18 +12,24 @@ on:
1112
branches: [main]
1213
types: [opened, closed, synchronize, review_requested]
1314

15+
permissions:
16+
contents: write # Modify code in PRs
17+
pull-requests: write # Add comments and labels to PRs
18+
issues: write # Add comments and labels to issues
19+
1420
jobs:
15-
format:
21+
actions:
1622
runs-on: ubuntu-latest
1723
steps:
18-
- name: Run Ultralytics Formatting
24+
- name: Run Ultralytics Actions
1925
uses: ultralytics/actions@main
2026
with:
21-
token: ${{ secrets._GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
22-
labels: true # autolabel issues and PRs
23-
python: true # format Python code and docstrings
24-
prettier: true # format YAML, JSON, Markdown and CSS
25-
spelling: true # check spelling
26-
links: false # check broken links
27-
summary: true # print PR summary with GPT4o (requires 'openai_api_key')
28-
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
27+
token: ${{ secrets._GITHUB_TOKEN || secrets.GITHUB_TOKEN }} # Auto-generated token
28+
labels: true # Auto-label issues/PRs using AI
29+
python: true # Format Python with Ruff and docformatter
30+
prettier: true # Format YAML, JSON, Markdown, CSS
31+
spelling: true # Check spelling with codespell
32+
links: false # Check broken links with Lychee
33+
summary: true # Generate AI-powered PR summaries
34+
openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Powers PR summaries, labels and comments
35+
brave_api_key: ${{ secrets.BRAVE_API_KEY }} # Used for broken link resolution

README.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,60 @@
1-
<br>
2-
<a href="https://www.ultralytics.com/" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
1+
<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>
32

43
# 🚀 Introduction
54

6-
Welcome to the [JSON2YOLO](https://github.com/ultralytics/JSON2YOLO) 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.
5+
Welcome to the [JSON2YOLO](https://github.com/ultralytics/JSON2YOLO) repository! This toolkit is designed to help you convert datasets in [JSON](https://www.ultralytics.com/glossary/json) format, particularly those following the [COCO (Common Objects in Context)](https://cocodataset.org/#home) standards, into the [YOLO format](https://docs.ultralytics.com/datasets/#yolo-format). The YOLO format is widely recognized for its efficiency in [real-time](https://www.ultralytics.com/glossary/real-time-inference) [object detection](https://docs.ultralytics.com/tasks/detect/) tasks.
76

8-
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.
7+
This conversion process is essential for [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) practitioners looking to train object detection models using frameworks compatible with the YOLO format, such as [Ultralytics YOLO](https://docs.ultralytics.com/models/yolo11/). Our code is flexible and designed to run across various platforms including Linux, macOS, and Windows.
98

10-
[![Ultralytics Actions](https://github.com/ultralytics/JSON2YOLO/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/JSON2YOLO/actions/workflows/format.yml) <a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://reddit.com/r/ultralytics"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
9+
[![Ultralytics Actions](https://github.com/ultralytics/JSON2YOLO/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/JSON2YOLO/actions/workflows/format.yml)
10+
[![Ultralytics Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://discord.com/invite/ultralytics)
11+
[![Ultralytics Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com/)
12+
[![Ultralytics Reddit](https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue)](https://reddit.com/r/ultralytics)
1113

12-
# ⚙️ Requirements
14+
## ⚙️ Requirements
1315

14-
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](https://github.com/ultralytics/JSON2YOLO/blob/main/requirements.txt) file. You can install these dependencies using the following pip command in your terminal:
16+
To get started with JSON2YOLO, you'll need a [Python](https://www.python.org/) 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](https://pip.pypa.io/en/stable/) command in your terminal:
1517

1618
```bash
17-
$ pip install -r requirements.txt # Installs all the required packages
19+
pip install -r requirements.txt # Installs all the required packages
1820
```
1921

20-
# 📚 Citation
22+
## 💡 Usage
23+
24+
To convert your COCO JSON dataset to YOLO format, run the `convert.py` script from your terminal. You need to specify the path to the directory containing your COCO JSON annotation files and the directory where you want to save the resulting YOLO label files.
25+
26+
```bash
27+
# Example usage: Convert COCO annotations to YOLO format
28+
python convert.py --json_dir path/to/coco/annotations --save_dir path/to/yolo/labels
29+
```
30+
31+
- `--json_dir`: Path to the directory containing COCO JSON annotation files (e.g., `instances_train2017.json`).
32+
- `--save_dir`: Path to the directory where the converted YOLO label files (`.txt`) will be saved.
33+
34+
This script will process the JSON files, extract bounding box information, and convert it into the YOLO format, saving one `.txt` file per image in the specified save directory. For more details on [dataset formats](https://docs.ultralytics.com/datasets/), refer to our documentation.
35+
36+
## 📚 Citation
2137

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

2440
[![DOI](https://zenodo.org/badge/186122711.svg)](https://zenodo.org/badge/latestdoi/186122711)
2541

26-
# 🤝 Contribute
42+
## 🤝 Contribute
2743

2844
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](https://docs.ultralytics.com/help/contributing/) to get started. Also, we'd love to hear about your experience with Ultralytics products. Please consider filling out our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A huge 🙏 and thank you to all of our contributors!
2945

30-
<!-- Ultralytics contributors -->
31-
32-
<a href="https://github.com/ultralytics/yolov5/graphs/contributors">
33-
<img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/image-contributors.png" alt="Ultralytics open-source contributors"></a>
46+
[![Ultralytics open-source contributors](https://raw.githubusercontent.com/ultralytics/assets/main/im/image-contributors.png)](https://github.com/ultralytics/ultralytics/graphs/contributors)
3447

35-
# ©️ License
48+
## ©️ License
3649

37-
Ultralytics is excited to offer two different licensing options to meet your needs:
50+
Ultralytics offers two licensing options to accommodate diverse needs:
3851

39-
- **AGPL-3.0 License**: Perfect for students and hobbyists, this [OSI-approved](https://opensource.org/license) open-source license encourages collaborative learning and knowledge sharing. Please refer to the [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for detailed terms.
40-
- **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](https://www.ultralytics.com/license).
52+
- **AGPL-3.0 License**: Ideal for students and enthusiasts, this [OSI-approved](https://opensource.org/license/agpl-v3) open-source license promotes collaboration and knowledge sharing. See the [LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) file for details.
53+
- **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](https://www.ultralytics.com/license).
4154

42-
# 📬 Contact Us
55+
## 📬 Contact Us
4356

44-
For bug reports, feature requests, and contributions, head to [GitHub Issues](https://github.com/ultralytics/JSON2YOLO/issues). For questions and discussions about this project and other Ultralytics endeavors, join us on [Discord](https://discord.com/invite/ultralytics)!
57+
For bug reports, feature requests, and contributions, please visit [GitHub Issues](https://github.com/ultralytics/JSON2YOLO/issues). For broader questions and discussions about this project and other Ultralytics initiatives, join our vibrant community on [Discord](https://discord.com/invite/ultralytics)!
4558

4659
<br>
4760
<div align="center">

general_json2yolo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2+
13
import contextlib
24
import json
35
from collections import defaultdict

labelbox_json2yolo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2+
13
import json
24
import os
35
from pathlib import Path

utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2+
13
import glob
24
import os
35
import shutil

0 commit comments

Comments
 (0)