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 boxbbox
.
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.1.tar.gz
.
File metadata
- Download URL: labelme2yolo-0.2.1.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3b567a94d410439aaf9f6cf71b8aa213aa760cfbedef3510de8f2c99bc2930c |
|
MD5 | 33d6e290f78914cc02e335c3092809c8 |
|
BLAKE2b-256 | 0594f34bcf75aa41cbae89fb3dfa76cf8d97be753f6d0ffbb6ab42c9d1690d84 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-win_amd64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-win_amd64.whl
- Upload date:
- Size: 775.4 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b7e55a49959a9aaf3f5910f84f8137942eaa01d7ef61d2e98485405ff574ed5 |
|
MD5 | 0269e2f1ce6a36064e0e310814194d14 |
|
BLAKE2b-256 | 03781f64f0685010d77466729c93d64adee33210e80e86daf89968802c7979df |
File details
Details for the file labelme2yolo-0.2.1-py3-none-win32.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-win32.whl
- Upload date:
- Size: 729.6 kB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65231d9cf1779dc423d9b0ed0349a65cc525795bf759fafdbb28ed2168728b56 |
|
MD5 | a640584d0e430064fc8586a490aa64a7 |
|
BLAKE2b-256 | dff61f8897fa391554df79957d5fae32cfdf1c557b87bf879f61f92f4d5b99df |
File details
Details for the file labelme2yolo-0.2.1-py3-none-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.1 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 | d4494672ded2ba88e84b412333c48a2b2f03a0e6ea30a14fd0ea1f4daa1eabf1 |
|
MD5 | 82b80bcb5c5ba516404e17c772d7d0bf |
|
BLAKE2b-256 | e2fd757c5c38a8c03f6f62b300f81f1344caca93cd2d13433f0a285565282d91 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-musllinux_1_2_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-musllinux_1_2_i686.whl
- Upload date:
- Size: 1.1 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 | f428d5127d3784ff053ec6200381549fef6d66ec92ac4943580311db350035fb |
|
MD5 | b733cef9eacb4ea7f322feb32d12971c |
|
BLAKE2b-256 | 187977feca1d7a784c7c3ecebdfa0fe6ebd399d25d3e0a6f2c3592a1775e9742 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-musllinux_1_2_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 1.0 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 | 4c6a727c58613a1366b8c073d338e91811b0636d6052a026ac053646434e4612 |
|
MD5 | adb842b2d150b88868c6fd11b8123cc8 |
|
BLAKE2b-256 | 68c910c42aa8cc2e356b096264bfa288e45b1e791bf4d8f562f1749c98d8e815 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.1 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 | dde2e880067d5bda76f8caff05d5cba4e187c4410e9ab905857603b4e0544f15 |
|
MD5 | 4b5741b5e5b06b67e9542d24a44cf7ef |
|
BLAKE2b-256 | 3d3a4f54bd38f67df00faf822f2fa70d5aabbf490ea25a7a24196aff82010038 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.0 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 | 1bc73f194b373e283cefb00759083903b343eb62f23fa82742dc4bc1370e2125 |
|
MD5 | c65639fb69091ad6bc207e55466f04b0 |
|
BLAKE2b-256 | 2addb299f4e8557875dca240703ede4544535ab8794833f679d0c00de381903f |
File details
Details for the file labelme2yolo-0.2.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.2 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 | 7bee0a1e9391988769ec80b18e321fe3ff17623cc381cc503aa66ea05e8d45ce |
|
MD5 | 64be0a9f9d68ed4f261dc0a17518ff4b |
|
BLAKE2b-256 | 298926246f722fa34272487a8af74e28d0ac7e25e2f2931c88450e0a2e7dd638 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.1 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 | fb711adebe8b485349f4295361fc948470039dea0afbf273e9a6e363f3014125 |
|
MD5 | c39d2a1cbf3068ffee38839df745a93b |
|
BLAKE2b-256 | 899ea9798aa045c7138cae2df5362662c4b4fb2ce4349a6c2588696f62865fc8 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.1 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 | 32a06878589e9a6e57516aba12de69b708dbeacaedb4120bdac9c739fc798e05 |
|
MD5 | 8ce942efd38213c531db099f38965cb4 |
|
BLAKE2b-256 | 4a7087d1f7607cee2dcaad3b0a93e06049128e22cbd3dc3f428ab9f5fd69a44f |
File details
Details for the file labelme2yolo-0.2.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 995.2 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 | 2fa239685eb4cc215e43b0714a2443502cb1ec78e8eeda05e99f6ac3444da6c0 |
|
MD5 | c12425469b2b8636fb59a891b460166c |
|
BLAKE2b-256 | d493497690e53e699ecb33743b872826ad3fb1b73b1186f2105c724545fbc3f1 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.0 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 | 69a478b7e6484130aedb7e1d1b4042bb4e718712fb592860a195e77f79851f70 |
|
MD5 | 5d65fb07a90507a9b0f2532472a0e46f |
|
BLAKE2b-256 | b8c187c2728262d59ce264077e83e608dbc85bc59bfad00502877451b346d399 |
File details
Details for the file labelme2yolo-0.2.1-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 919.0 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 | 48541733d2d924df6fdb942115ff94fa1a8d8f366caaea7fabad97b779ecf834 |
|
MD5 | ce56075a9e9bffbcae35496a8ff71a55 |
|
BLAKE2b-256 | d3c277c55283cee084983f5232705718d975f4c1acd4b853dc83f0c33f5e9aff |
File details
Details for the file labelme2yolo-0.2.1-py3-none-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: labelme2yolo-0.2.1-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 940.1 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 | 4d9410c900ac20e86fca3a76d399f30a7d4bf9a261cb2e0f4646d9175fc77029 |
|
MD5 | ebc6b14878c0b1218dd827e71ee06ec5 |
|
BLAKE2b-256 | 2a26628ba4982487919f6a7d654e5ccc39fae5bb093f557997c8e6d6ac6c8894 |