Skip to main content

Forked from rooneysh/Labelme2YOLO

Labelme2YOLO

PyPI - Version PyPI - Python Version

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.

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.

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.

python labelme2yolo.py --json_dir /home/username/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,

/home/username/labelme_json_dir/YOLODataset/labels/train/
/home/username/labelme_json_dir/YOLODataset/labels/test/
/home/username/labelme_json_dir/YOLODataset/labels/val/
/home/username/labelme_json_dir/YOLODataset/images/train/
/home/username/labelme_json_dir/YOLODataset/images/test/
/home/username/labelme_json_dir/YOLODataset/images/val/

/home/username/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,

/home/username/labelme_json_dir/train/
/home/username/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.

python labelme2yolo.py --json_dir /home/username/labelme_json_dir/

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

/home/username/labelme_json_dir/YOLODataset/labels/train/
/home/username/labelme_json_dir/YOLODataset/labels/val/
/home/username/labelme_json_dir/YOLODataset/images/train/
/home/username/labelme_json_dir/YOLODataset/images/val/

/home/username/labelme_json_dir/YOLODataset/dataset.yaml

3. Convert single JSON file

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

python labelme2yolo.py --json_dir /home/username/labelme_json_dir/ --json_name 2.json

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

/home/username/labelme_json_dir/2.text
/home/username/labelme_json_dir/2.png

Installation

pip install labelme2yolo

License

labelme2yolo is distributed under the terms of the MIT license.

Metadata

Release files for labelme2yolo 0.0.5

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.0.5
File Size Uploaded
labelme2yolo-0.0.5.tar.gz 7.4 kB Details

Built distribution (wheel)

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

Total release size: 15.0 kB

Release files / labelme2yolo-0.0.5.tar.gz

Download URL labelme2yolo-0.0.5.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8182dd7935fe15200d3605411b518010d3705f7d105593f868cc14c440e67326
BLAKE2b-256 checksum
How to use checksums
e5d47647cc3c4a6aba7e8e04e5e68e6974863b65f252e7484cf6974f696ab3af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.1

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

Download URL labelme2yolo-0.0.5-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e37b8e580ae0b9e47f7a0d6ad1a5267deb8414a0431ec9012e8f0f7e7ffae2f
BLAKE2b-256 checksum
How to use checksums
8eb84bedc71d2d51db1b7d37080ded0881610ab381742a0dde32926b9e77ea6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.1

Release history Release notifications | RSS feed

0.3.2

15 release files

0.3.0

15 release files

0.2.5

15 release files

0.2.4

15 release files

0.2.3

15 release files

0.2.2

15 release files

0.2.1

15 release files

0.2.0

15 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

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