This script converts the JSON format output by LabelMe to the text format required by YOLO serirs.
Project description
Labelme2YOLO
Labelme2YOLO efficiently converts LabelMe's JSON format to the YOLOv5 dataset format. It also supports YOLOv5/YOLOv8 segmentation datasets, making it simple to convert existing LabelMe segmentation datasets to YOLO format.
New Features
- export data as yolo polygon annotation (for YOLOv5 & YOLOV8 segmentation)
- Now you can choose the output format of the label text. The two available alternatives are
polygon
and bounding box(bbox
).
Performance
Labelme2YOLO is implemented in Rust, which makes it significantly faster than equivalent Python implementations. In fact, it can be up to 100 times faster, allowing you to process large datasets more efficiently.
Installation
pip install labelme2yolo
Arguments
--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.1 means 10% 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. Converting JSON files and splitting training, validation datasets
You may need to place all LabelMe JSON files under labelme_json_dir and then run the following command:
labelme2yolo --json_dir /path/to/labelme_json_dir/
This tool will generate dataset labels and images with YOLO format in different folders, such as
/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
2. Converting JSON files and splitting training, validation, and test datasets with --val_size and --test_size
You may need to place all LabelMe JSON files under labelme_json_dir and then run the following command:
labelme2yolo --json_dir /path/to/labelme_json_dir/ --val_size 0.15 --test_size 0.15
This tool will generate dataset labels and images with YOLO format in different folders, such as
/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
How to build package/wheel
pip install maturin
maturin develop
License
labelme2yolo
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file labelme2yolo-0.2.3.tar.gz
.
File metadata
- Download URL: labelme2yolo-0.2.3.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7f8ff4655f3832e50cd7d99c9ee841bd9ecb89ea9f15e28fbd96ab388e587fc |
|
MD5 | 70ae00a362f9146ca04235acbbb22e21 |
|
BLAKE2b-256 | 3256ca761941e7823a4afc07ca5cf6e64e55b2880abefffe688e7e2271225558 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-win_amd64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e73c8880fe5a0d49df627a55e9dc4121d5708f6701b9ec497108a42588f421cb |
|
MD5 | 2e2a4016357973bdaf674977bcde6cd7 |
|
BLAKE2b-256 | 257b52c70e5148e95886a8a4706ae865ed5a519dfb0e86b79ec33f62adef3ad4 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-win32.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-win32.whl
- Upload date:
- Size: 971.9 kB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66abac20abe7b259028da4679f1f83707f20df230f602439eaa78a5a15dd3b51 |
|
MD5 | 07caba9cb19e16c52f566c136121a4b8 |
|
BLAKE2b-256 | 8c5bab3faee5dd81bf47bfad75e2d79f916c77703dee17c11817b80642123035 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d30d304e9ffdae6889f5383aefcef7ab3fafcf3220f33c053ead2d86e88a607 |
|
MD5 | 7fc0f674e7b95fa75641093e1382e14b |
|
BLAKE2b-256 | 8751484951213ac7ce56a8ab35c970d9a44b50ea8a09b6965873b1e430fadc88 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-musllinux_1_2_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-musllinux_1_2_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 324e49148bcb74bfc5e724b53c0c25bf50d0e61ca06099ed2c9bff8fda2c5ac7 |
|
MD5 | f3b7b640a830c939310aceb02e47bf0a |
|
BLAKE2b-256 | bf17078c6603ca2b3e67df27f085a2ed055e097c482d024a59fcdd82ba797c63 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-musllinux_1_2_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b76afcc7f7b203fe9c484d26df0392d8c5fd874f3af7fb8ca3639d995758ca9 |
|
MD5 | 31d8ac765c19c9a7515bf559bd84090d |
|
BLAKE2b-256 | 4bac002e8ae15231e73966680fee101440a101fb47f47c61707443559e02eaae |
File details
Details for the file labelme2yolo-0.2.3-py3-none-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f05fc028da703bd4394003bba37fe2b47868a9feae4cc3494dd896db8af5c9c0 |
|
MD5 | 9f88c21f8b91161f6d298845814f8853 |
|
BLAKE2b-256 | 47bd9f25af2071d5399c2f2136d11e3f6bc73d1c9b9a6d97969b532573a5071c |
File details
Details for the file labelme2yolo-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bafb4cb0e09873003abb53420b4b63d3b944564e7981a782214af8a37a0cea64 |
|
MD5 | 297b82f4d2e5ffb426ba4d7bb3654358 |
|
BLAKE2b-256 | 0895367e02282334cbd9ede2b66ba17452e906ef086a3b570d7fbe37b4cc4788 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e698c6917e55ffb72915fdde1c43f50a5fbc7bfe94b61a5dd12d631b02b25dd0 |
|
MD5 | 9bbdf3af96c98a8bc9da8b9422d11def |
|
BLAKE2b-256 | a26b1020ac982742201a9f6771b134de27ccc997ca870173fa1d9b9a07291cbd |
File details
Details for the file labelme2yolo-0.2.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d672dbf518682edc9d553b9971619101789f7b331ffec467f3257e14d27d3f5b |
|
MD5 | a82e78c001121040d42ec9dcdf57f7d1 |
|
BLAKE2b-256 | 1eb613633f1c5aff8ada06f1452bf7bf50bc86d44d3d6011a86e1fdb98fb2660 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39f062283efe93eb0ab7933446f122f4be19ceacdc21675d219c23f0e5032183 |
|
MD5 | 6d520224bac3334e28bc9ca684048880 |
|
BLAKE2b-256 | 03f53d4bc589b00daff3622760623f7aa53b80eb46343eb43aae6247d6d5e651 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 182084aeb9c1bace9d23f8c1461ca5fdd0c43b2b82ca6da3c3e97978f59c654e |
|
MD5 | b7a308467d1024ec6276251094d88265 |
|
BLAKE2b-256 | f73d32e3a0dec94d3e0a3b765697062a73039eb621f40db9811e7fb67527a77c |
File details
Details for the file labelme2yolo-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b6dadd30fcce23bcea3a38b23f5e1b9034ecc2960515cab5779aa2e8028cde9 |
|
MD5 | c50a33b6ed38273f8d73004a446ce762 |
|
BLAKE2b-256 | 0ea3b446fbe8629f2323a79a5d1ca8826a5eb1d5db8defb490180d9ed1b87faa |
File details
Details for the file labelme2yolo-0.2.3-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 690f763310bc1bf16540786987335a25ebffafe4fe6eb84ddc466425de245ea0 |
|
MD5 | 032cb66b6425aae30844eb0c3cacf0db |
|
BLAKE2b-256 | b186c3e469c9006ac59ba0ca629d2ee4cf008eb48baed18b24bd8ff7bcdfab49 |
File details
Details for the file labelme2yolo-0.2.3-py3-none-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.3-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503c2f7b1d6726f98c5f2f1d45c1e0ec2ac34f0f0b0edfbc1b506af05612fc56 |
|
MD5 | 4905f3c2f5f5a7a745a13d64523f5fe5 |
|
BLAKE2b-256 | 2e7a7a99ae4abc698c7b3d3cbf999a6ae03ac903d637d19617f599c3bd4ed162 |