This script converts the JSON format output by LabelMe to the text format required by YOLO serirs.
Project description
Labelme2YOLO
Labelme2YOLO is a powerful tool for converting LabelMe's JSON format to YOLOv5 dataset format. This tool can also be used for YOLOv5/YOLOv8 segmentation datasets, if you have already made your segmentation dataset with LabelMe, it is easy to use this tool to help convert to YOLO format dataset.
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
).
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.0.tar.gz
.
File metadata
- Download URL: labelme2yolo-0.2.0.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91780f643da8eca8d6cf9b1649541dbcb3d3b0892ecd612f75745ea0ba4e762e |
|
MD5 | b85650d66c1e0cdfbaf0cec0cfd0c3e1 |
|
BLAKE2b-256 | 357f489d637896e95eb8330fb160d75c245c331e8a1e71fb76dea73de6498263 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-win_amd64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-win_amd64.whl
- Upload date:
- Size: 676.9 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f70c31a7d4cbc5b104d20e44aca610fd73af1b76aab3c40af6820480c8c135cd |
|
MD5 | c34264ccc06b3223b7ffe5bb0664d943 |
|
BLAKE2b-256 | ad5551862703d8b55a67ef960a9995c9bdb231f25f6fe5eb2957e56a3534ac05 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-win32.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-win32.whl
- Upload date:
- Size: 638.6 kB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cdc3e81631cb83f208cca55aaa4b9c70bac690c2c83645ce61954ebe80406a1 |
|
MD5 | 48c5ccbc0f5df23aff92a537c7be0078 |
|
BLAKE2b-256 | a7cb4909e566e62c931a01fe755151f120a678df2efb97a6fd8c3fe9c966872f |
File details
Details for the file labelme2yolo-0.2.0-py3-none-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 954.2 kB
- 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 | 2fc395abeb49c10754eadd0a9dd70d9790a32046951cf1091993f7a301686913 |
|
MD5 | 90e0bd24295727226a39cf39b72050c3 |
|
BLAKE2b-256 | 42fdb247fd73bd59750054b7d459c7c5cb11d2c187aa775c33898374f8f79a9d |
File details
Details for the file labelme2yolo-0.2.0-py3-none-musllinux_1_2_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-musllinux_1_2_i686.whl
- Upload date:
- Size: 944.6 kB
- 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 | a1daf44853ce82543049944b329338465dfe356061669dbe877b052a002bf33b |
|
MD5 | cc5bc98e73c17248857493d61ddb535d |
|
BLAKE2b-256 | 5867ed8b81fed6b29a91cc2f35121057976e3bab7d846894dddfe4eb9aa8b552 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-musllinux_1_2_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 889.1 kB
- 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 | 2eb065d07f29c051635e08340ca7f8fd6834bc4b602f19c69e636a7470470e15 |
|
MD5 | 5543c688b7a7c8b5766005ee3e0d3384 |
|
BLAKE2b-256 | 6804c7d4f3c85bbf0da41b42f41647b3f91e3189d8847ca429e6e15a1a70acc4 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 915.4 kB
- 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 | 0d8f2b3c03d2d340e27254fad2231c2fff1f1d624c67d165076fffc86750bcb1 |
|
MD5 | 709b2dbe3aa6563d2b2621b4e1f611ce |
|
BLAKE2b-256 | 21ab8d6563825e59cc04a396b86a936d3f51ad3cedd905812e3c744e2beff9a3 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 900.3 kB
- 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 | 7d748854049945a15c572d4ffa0e268763739abea8ee46ea99422f0d9b6937b0 |
|
MD5 | e37e444b75f6ce42a7a61c463b16ae57 |
|
BLAKE2b-256 | bed136dfe7c0214e66c7a637e9eeaabef8521d76eebb700bd890ccb122b06d84 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.0 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 | dc4d00e621ed762849456e5226696f4469d83495a0e0da2d5756fc4c65dd9c85 |
|
MD5 | 40840ef9ccb0c0694fc2e152e74024c0 |
|
BLAKE2b-256 | 75b600fcfcdd517ae4c1d47cc9d7de70130b070469aef959caa13bcdf342ef51 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 972.3 kB
- 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 | 6adac9ade152834f40b0f6e03eb1d1aa4630185aa7c4e930861c8846c9c7222e |
|
MD5 | 043007cda8e4c99b3ebe373c39a7545c |
|
BLAKE2b-256 | 7a48ee20a5a1824c64c6ac2ad96ae91eac64d77f15ee0ef4e6399b36b2af9c1e |
File details
Details for the file labelme2yolo-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 946.5 kB
- 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 | e2bcbaab31d354e02e28af2424cd0a8bc46523835b26c87c44c58a0d28e9581a |
|
MD5 | 43166d716723538649a20067cfdfdb91 |
|
BLAKE2b-256 | c987378c779b6f50466a4d108c5f20d3e21cf20d3bae79e9f304217996e7e954 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 865.8 kB
- 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 | a1f134270ea1c23aeb9ac09920f896ee2d77ee503a11439a9fed005351b5e9b9 |
|
MD5 | bd94968f9fa1c56e324979e0f2139ad6 |
|
BLAKE2b-256 | 6568b6d4b3976fb447d69624662684c2ae57fa74697007eb96ab809336af97b3 |
File details
Details for the file labelme2yolo-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 890.3 kB
- 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 | 51e3ccd1c190f4fdf373b66419586ba10686847c157e19f5a2de020e0d46a90f |
|
MD5 | 4bcf59c0d6d0f093241560981a392875 |
|
BLAKE2b-256 | ed5906ac531f3fe1c67ff19818ed07308d26e14109e5de689051fba348f85faf |
File details
Details for the file labelme2yolo-0.2.0-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 800.8 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73d39d2a0ef3b27d1a7148a6861a30b07bb4cfb5b68f2ed37998a830af50dd93 |
|
MD5 | 5eac9e34869fae88f4d80cc8e1206fc1 |
|
BLAKE2b-256 | bcd4b297528a85ebe24a8b853abfbe7eb85a7b56fd84c2fdc036ca75e208e6ec |
File details
Details for the file labelme2yolo-0.2.0-py3-none-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 816.9 kB
- 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 | c491b90c62ab2e0dde30bea3137212229d60be657aebe99e36c095fad848fc2c |
|
MD5 | 8c1d8bb8bc80a8f7ad56424d134a2463 |
|
BLAKE2b-256 | 173d65c70f14171361a31d79c693020d9efab335b8289e3b35455b461d463033 |