Skip to main content

Labelme2YOLO

Forked from rooneysh/Labelme2YOLO

PyPI - Version PyPI - Downloads PyPI - Python Version Codacy Badge

Help converting LabelMe Annotation Tool JSON format to YOLO text file format. If you've already marked your segmentation dataset by LabelMe, it's easy to use this tool to help converting to YOLO format dataset.

New

  • export data as yolo polygon annotation (for YOLOv5 v7.0 segmentation)
  • Now you can choose the output format of the label text. The two available alternatives are polygon and bounding box (bbox).

Installation

pip install labelme2yolo

Parameters Explain

--json_dir LabelMe JSON files folder path.

--val_size (Optional) Validation dataset size, for example 0.2 means 20% for validation.

--test_size (Optional) Test dataset size, for example 0.2 means 20% for Test.

--json_name (Optional) Convert single LabelMe JSON file.

--output_format (Optional) The output format of label.

--label_list (Optional) The pre-assigned category labels.

How to Use

1. Convert JSON files, split training, validation and test dataset by --val_size and --test_size

Put all LabelMe JSON files under labelme_json_dir, and run this python command.

labelme2yolo --json_dir /path/to/labelme_json_dir/ --val_size 0.15 --test_size 0.15

Script would generate YOLO format dataset labels and images under different folders, for example,

/path/to/labelme_json_dir/YOLODataset/labels/train/
/path/to/labelme_json_dir/YOLODataset/labels/test/
/path/to/labelme_json_dir/YOLODataset/labels/val/
/path/to/labelme_json_dir/YOLODataset/images/train/
/path/to/labelme_json_dir/YOLODataset/images/test/
/path/to/labelme_json_dir/YOLODataset/images/val/

/path/to/labelme_json_dir/YOLODataset/dataset.yaml

2. Convert JSON files, split training and validation dataset by folder

If you already split train dataset and validation dataset for LabelMe by yourself, please put these folder under labelme_json_dir, for example,

/path/to/labelme_json_dir/train/
/path/to/labelme_json_dir/val/

Put all LabelMe JSON files under labelme_json_dir. Script would read train and validation dataset by folder. Run this python command.

labelme2yolo --json_dir /path/to/labelme_json_dir/

Script would generate YOLO format dataset labels and images under different folders, for example,

/path/to/labelme_json_dir/YOLODataset/labels/train/
/path/to/labelme_json_dir/YOLODataset/labels/val/
/path/to/labelme_json_dir/YOLODataset/images/train/
/path/to/labelme_json_dir/YOLODataset/images/val/

/path/to/labelme_json_dir/YOLODataset/dataset.yaml

3. Convert single JSON file

Put LabelMe JSON file under labelme_json_dir. , and run this python command.

labelme2yolo --json_dir /path/to/labelme_json_dir/ --json_name 2.json

Script would generate YOLO format text label and image under labelme_json_dir, for example,

/path/to/labelme_json_dir/2.text
/path/to/labelme_json_dir/2.png

How to build package/wheel

  1. install hatch
  2. Run the following command:
hatch build

License

labelme2yolo is distributed under the terms of the MIT license.

Metadata

Release files for labelme2yolo 0.1.3

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

Source distribution (sdist)

Source distribution for labelme2yolo 0.1.3
File Size Uploaded Provenance Actions
labelme2yolo-0.1.3.tar.gz 16.0 kB Without provenance Details for labelme2yolo-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for labelme2yolo 0.1.3
File Interpreter ABI Platform Actions
labelme2yolo-0.1.3-py3-none-any.whl Python 3 none any Details for labelme2yolo-0.1.3-py3-none-any.whl

Total release size: 24.7 kB

Release files / labelme2yolo-0.1.3.tar.gz

Download URL labelme2yolo-0.1.3.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3c3f703eea53fd9fb7fe1df59ad60b255beee03b3ff284a6997b156e8b22ab13
BLAKE2b-256 checksum
How to use checksums
72e0738bb1ee14170f08743518d8d5cf6320238db7b4f9a2fde1ba82da45aee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.1

Release files / labelme2yolo-0.1.3-py3-none-any.whl

Download URL labelme2yolo-0.1.3-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfdc2d899b4f335dd7ad9eaba759a17d70648668c9c9f07e95ff91a51664619f
BLAKE2b-256 checksum
How to use checksums
fd46c0533e4abbc07f432bc4b1aabb4785a3345bf0b6dcf1c2dbfcfd5d620ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.1

Security for labelme2yolo 0.1.3

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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