From 51831202021af196d92e4486811c4eae18ca529a Mon Sep 17 00:00:00 2001 From: Jakob Gebler Date: Mon, 26 May 2025 11:04:44 +0200 Subject: [PATCH 1/7] update the readme file according to the changes of the converter scripts in the main repository of ultralytics. --- README.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index db6ce49..c91f9b0 100755 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ This conversion process is essential for [machine learning](https://www.ultralyt [![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/) [![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) +> **⚠️ Disclaimer**: This project has been moved and embedded in the ultralytics main package. The standalone converter scripts in this repository are deprecated. The documentation of the new package can be seen at the documentation of the new +`convert_coco()` in the [Ultralytics data converter reference documentation](https://docs.ultralytics.com/reference/data/converter/). + ## ⚙️ Requirements 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: @@ -21,17 +24,19 @@ pip install -r requirements.txt # Installs all the required packages ## 💡 Usage -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. +This package has become part of the ultralytics python package. Therefore the conversion can be done with the `coco_convert` method. An example of keypoint annotated labels looks like this: -```bash -# Example usage: Convert COCO annotations to YOLO format -python convert.py --json_dir path/to/coco/annotations --save_dir path/to/yolo/labels -``` +```python +from ultralytics.data.converter import convert_coco -- `--json_dir`: Path to the directory containing COCO JSON annotation files (e.g., `instances_train2017.json`). -- `--save_dir`: Path to the directory where the converted YOLO label files (`.txt`) will be saved. +convert_coco( + labels_dir="", + save_dir="", + use_keypoints=True, +) +``` -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. +This method 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. ## 📚 Citation From d940693b8ed4e534cc4f6dbc0e6aefe4978584e4 Mon Sep 17 00:00:00 2001 From: Jakob Gebler Date: Mon, 26 May 2025 11:07:08 +0200 Subject: [PATCH 2/7] example output path update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c91f9b0..ea4431b 100755 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ from ultralytics.data.converter import convert_coco convert_coco( labels_dir="", - save_dir="", + save_dir="", use_keypoints=True, ) ``` From 8c52d9453671edab32b04091ac79ad6d1898228b Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Mon, 26 May 2025 09:06:57 +0000 Subject: [PATCH 3/7] Auto-format by https://ultralytics.com/actions --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea4431b..7b62294 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This conversion process is essential for [machine learning](https://www.ultralyt [![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) > **⚠️ Disclaimer**: This project has been moved and embedded in the ultralytics main package. The standalone converter scripts in this repository are deprecated. The documentation of the new package can be seen at the documentation of the new -`convert_coco()` in the [Ultralytics data converter reference documentation](https://docs.ultralytics.com/reference/data/converter/). +> `convert_coco()` in the [Ultralytics data converter reference documentation](https://docs.ultralytics.com/reference/data/converter/). ## ⚙️ Requirements @@ -30,7 +30,7 @@ This package has become part of the ultralytics python package. Therefore the co from ultralytics.data.converter import convert_coco convert_coco( - labels_dir="", + labels_dir="", save_dir="", use_keypoints=True, ) From 7a0d6025d1b73e86c2af999694ad1d69ce1ce27a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 11 Jul 2025 10:30:02 +0200 Subject: [PATCH 4/7] Update README.md Signed-off-by: Glenn Jocher --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7b62294..5b6852e 100755 --- a/README.md +++ b/README.md @@ -11,8 +11,7 @@ This conversion process is essential for [machine learning](https://www.ultralyt [![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/) [![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) -> **⚠️ Disclaimer**: This project has been moved and embedded in the ultralytics main package. The standalone converter scripts in this repository are deprecated. The documentation of the new package can be seen at the documentation of the new -> `convert_coco()` in the [Ultralytics data converter reference documentation](https://docs.ultralytics.com/reference/data/converter/). +> **📢 Important Update**: The JSON2YOLO project is now integrated into the main Ultralytics package. 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](https://docs.ultralytics.com/reference/data/converter/). ## ⚙️ Requirements From db38ff0d4a23ccbe1e2503e10a2670601ccb7111 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 11 Jul 2025 10:31:46 +0200 Subject: [PATCH 5/7] Update README.md Signed-off-by: Glenn Jocher --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5b6852e..36c93d2 100755 --- a/README.md +++ b/README.md @@ -23,19 +23,26 @@ pip install -r requirements.txt # Installs all the required packages ## 💡 Usage -This package has become part of the ultralytics python package. Therefore the conversion can be done with the `coco_convert` method. An example of keypoint annotated labels looks like this: +JSON2YOLO functionality is now part of the main `ultralytics` Python package. To use the converter, first install the package: + +```bash +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: ```python from ultralytics.data.converter import convert_coco convert_coco( - labels_dir="", - save_dir="", + labels_dir="path/to/labels.json", + save_dir="path/to/output_dir", use_keypoints=True, ) ``` -This method 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. +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](https://docs.ultralytics.com/datasets/). + ## 📚 Citation From 1f77aceb9aea35f1031c5fb4ec224070997698d1 Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Fri, 11 Jul 2025 08:31:56 +0000 Subject: [PATCH 6/7] Auto-format by https://ultralytics.com/actions --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 36c93d2..6ad7acd 100755 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ convert_coco( 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](https://docs.ultralytics.com/datasets/). - ## 📚 Citation If you find our tool useful for your research or development, please consider citing it: From 7c2dedc1b31ace7e14e48b0f4d639a8ff6fedf4d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 11 Jul 2025 10:37:34 +0200 Subject: [PATCH 7/7] Update README.md Signed-off-by: Glenn Jocher --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ad7acd..4f4073a 100755 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This conversion process is essential for [machine learning](https://www.ultralyt [![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/) [![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) -> **📢 Important Update**: The JSON2YOLO project is now integrated into the main Ultralytics package. 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](https://docs.ultralytics.com/reference/data/converter/). +> **📢 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](https://docs.ultralytics.com/reference/data/converter/). ## ⚙️ Requirements