Skip to main content

coco-to-yolo

Simple command line tool to convert COCO object detection datasets to YOLO format.

Usage

  1. Install via pip pip install coco-to-yolo
  2. Convert COCO dataset to ultralytics YOLO format using coco_to_yolo <<coco_dir>> <<output_dir>>

By default the script assumes the coco dataset to be structured as follows:

<<coco_dir>>
├── annotations
│   └── annotations.json     # Exactly ONE annotation file in COCO json format
└── images                   # Arbitary number of images (matching the file names 
    ├── image1.jpeg          # in the annotations json file)
    ├── image2.jpeg         
    └── ...

Split generation

By default the script will split 10% of the data into a test split and not generate a validation split. The ratio of splitted test and validation data can be adapted by specifying the --test_ratio and --val_ratio arguments, e.g.

Example usage

coco_to_yolo /home/COCO_ds /home/COCO_ds --test_ratio 0.15 --val_ratio 0.1

will convert the dataset in the /home/COCO_ds to the format required by YOLO, split 15% of the data for the testing, 10% for validation, and store the resulting dataset in /home/COCO_ds

Contributions

Feel free to suggest extensions and point out mistakes by creating an issue or sending me a pull request.

Metadata

Release files for COCO-to-YOLO 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for COCO-to-YOLO 1.2.1
File Size Uploaded Provenance
coco_to_yolo-1.2.1.tar.gz 4.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for COCO-to-YOLO 1.2.1
File Interpreter ABI Platform
coco_to_yolo-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / coco_to_yolo-1.2.1.tar.gz

Download URL coco_to_yolo-1.2.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
06da297a9205dde3c6c1b70842cb974373666ded0330b934178aeaf9b6f52be7
BLAKE2b-256 checksum
How to use checksums
b40b25337bec2b8a4f92eb2192c5d4fdc0bb0a76f64df7aaaef1de571bb23484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / coco_to_yolo-1.2.1-py3-none-any.whl

Download URL coco_to_yolo-1.2.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8122009339e71963cdecdeb9f59278672e5bc7bfc54c9c3facbc7fd498b5102f
BLAKE2b-256 checksum
How to use checksums
e437454184d8b6106bf042f77a58d60a23a13aa7d438467346687568b3ea3add
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for COCO-to-YOLO 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page