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.2.tar.gz
.
File metadata
- Download URL: labelme2yolo-0.2.2.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9e9bfe654975ab02720697a8aac7b944ee1bdb1cd0216a576981c8c22ec9f0 |
|
MD5 | d9b753f68e73019f5bb7ed61880d8459 |
|
BLAKE2b-256 | c1e077bf951487478fdf02ac026981d01fd2991860aa76dda558f2b5b2ca8f2e |
File details
Details for the file labelme2yolo-0.2.2-py3-none-win_amd64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-py3-none-win_amd64.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b25590ac94f28000abed48258eaed1785bd1e2e67ea9de979d619737a16d62 |
|
MD5 | 8a372d71dc75c4a21397672d07309b9f |
|
BLAKE2b-256 | 56a864d2c0593282353d9a2ba0e197f7701f5a9c146a8bfe255ce28e980ea6fc |
File details
Details for the file labelme2yolo-0.2.2-py3-none-win32.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-py3-none-win32.whl
- Upload date:
- Size: 954.1 kB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ab6f6c4ee96dbb3e124f368d9502cf1e4049bbc60ad939b0d74686d981dbfd6 |
|
MD5 | 3f3645211b9d73d484f7a811b7cf8a2c |
|
BLAKE2b-256 | 30ec74a39f36585221893f2015128f150df98dedba9c9bb582accdb72e0247d3 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | 028606d347f20d981bbd597b9c4327fb7cb1a853b6ab04b993d5cf69f3cca342 |
|
MD5 | 91a6f48d76b897f9610ef31d563c200f |
|
BLAKE2b-256 | a6a944191333db6982b4e54762a8dd26734a587196bcc78466b038fe3849beb4 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-musllinux_1_2_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | 71f1fb3be43d3328cbaf57e311acf6e4b7a2ab1d68054b266eb6e24e8d800a95 |
|
MD5 | dd15b0b012f7856ae1dc26845eb2ae8d |
|
BLAKE2b-256 | bd0ddd186eb61e870a80e5d2fbd86e5f80efb317cdfb84ef2ebc0e5ad6e8d024 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-musllinux_1_2_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | af5fe2d8646f3c707bfccd58ba8ec6cad17e06e3fc5495f32998196b70cbde50 |
|
MD5 | 0f6b1a8c9fdc19078e9892f2e54af4e3 |
|
BLAKE2b-256 | 8c36d29cf6b1ecc7db49acd91d2307c10b77a26e284b2afcc3722d39bee4dbe0 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.3 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 | 8f0ebb51f4566473027851b71ad75560bfc93dc1992f03aa2121691b31c6610b |
|
MD5 | fcbcb9434e8610d2309d96ffd09ca209 |
|
BLAKE2b-256 | 9e4ddee99004277900cda207ee6f1c6c819a4dd6694b37c28313562a23137eb3 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | 8e6ec2fb4ab3945a4b9d004a47271f862f67fa987dfafbb6c0fa09044730782e |
|
MD5 | f2bcc0c1813d72ed33e8247ceaec50ba |
|
BLAKE2b-256 | 4ca3298bc7a5565d89e58e709a10f599cf981ca5293b062da3799fc1c9d7feaf |
File details
Details for the file labelme2yolo-0.2.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | bf1a9fa88caa3b73f185317c8d903eb986127793ecf6796d4dcc6d600a74b229 |
|
MD5 | 047b1e1faf3f99b197da25ae38eaf9d0 |
|
BLAKE2b-256 | 1e91f0140c4a84bad37ee1882fd4ad316d95933843541e8a6d6fdf308ddf02ec |
File details
Details for the file labelme2yolo-0.2.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | be8b9ce89b19267291a2c9e1b0bcfa42af19b9740c9f9065d21c987177176307 |
|
MD5 | 79d41e0c0c9156e1e19201ddab13ae1d |
|
BLAKE2b-256 | d9851f5516ee3d93ac0346d4f86ccc2e37ab6214caad0ba3bfd92ef0f68f8336 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | 594ef507f63507a519df21d51bdfb5edefc7ca823e480158846dc5ac6f98958e |
|
MD5 | 0e7280f0a27ce57267b5ed0180076b10 |
|
BLAKE2b-256 | efb8d13ce04f90c58808fb9f31f7cc9a7910b37d41872e860c08628bfb38caaa |
File details
Details for the file labelme2yolo-0.2.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | 507ef7fc10dc03836b3c3d5fe83506411119a2dc33ab6355ac10be2fdf8e70c1 |
|
MD5 | 96f98c756da14f72f3dae807030a9148 |
|
BLAKE2b-256 | 9568b23282883ccb514f34ceea1b3748e73cb63a6dffc6b71eb3f1d1f48eeced |
File details
Details for the file labelme2yolo-0.2.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | da443737e04f050610540707fb6088c6b0c8fdc584e6e54e7c308d7b4654a1a0 |
|
MD5 | a22d25db9248830ff84d1e15dd568ab0 |
|
BLAKE2b-256 | 9f46e20a488728aadad2c637d08faabe80202727e5c223aa4a5b4a9cd9aac220 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-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 | 96b20c9ebd78145d47328419108eddf7860f369d9d3a43d8e8c88e4183017cee |
|
MD5 | 347c4223131cf2f56d7f6fa79a2d60d0 |
|
BLAKE2b-256 | 766b17ab2ea6d294717d1aeeb4413223f72eaf6a3da32b076e3a35c4cd515219 |
File details
Details for the file labelme2yolo-0.2.2-py3-none-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.2-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.2 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 | 3be07bd9b146e52d11421644bc4e3c4057132d0d295ef6bf7075717ec37fd664 |
|
MD5 | fbf2f6957f3b8a8ec875dce24763bc65 |
|
BLAKE2b-256 | a60e90ce1e070b94c18504629deaae117eae63cbb636c16f9f4038295e5c645f |