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
[LABEL_LIST]... Comma-separated list of labels in the dataset.
Options
-d, --json_dir <JSON_DIR> Directory containing LabelMe JSON files.
--val_size <VAL_SIZE> Proportion of the dataset to use for validation (between 0.0 and 1.0) [default: 0.2].
--test_size <TEST_SIZE> Proportion of the dataset to use for testing (between 0.0 and 1.0) [default: 0].
--output_format <OUTPUT_FORMAT> Output format for YOLO annotations: 'bbox' or 'polygon' [default: bbox] [aliases: format] [possible values: polygon, bbox].
--seed Seed for random shuffling [default: 42].
-h, --help Print help.
-V, --version Print version.
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
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
Hashes for labelme2yolo-0.2.5-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc4a21c0c2496a8092fcb64e855255b75aef68762bde8448d82771d4d6a7a2c3 |
|
MD5 | e9c02adf0bdd51c14d34041cc59ef145 |
|
BLAKE2b-256 | 31bb1c5c51a27a6ab07ff4c5a500e68127a74e5a4d269c977669a0edac5f5555 |
Hashes for labelme2yolo-0.2.5-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 095518e5f194e04ed1a15bf78890be027698eebb467668761fa7f8f9cb69cad1 |
|
MD5 | 8fbf00d705b0645f1f43594a6be3790d |
|
BLAKE2b-256 | 882cacd5001f4303f3d8afc981cc526adfd9536adfa61a4e5607a457a11a390d |
Hashes for labelme2yolo-0.2.5-py3-none-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67529cad16cea202b0d8475b0c25b94d9086ff9e384672ce9eebbf9e93933385 |
|
MD5 | 640e31ae941398c762ee62e632a01298 |
|
BLAKE2b-256 | 86820f64a0a0df48af16da5f912f3a6eec3f60bd0357209ac02f745c418748d1 |
Hashes for labelme2yolo-0.2.5-py3-none-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6193b07f2092a9cb1e712b3856536afe6607b7e24a1dd9523af7f5a28a638c56 |
|
MD5 | f609877cd791824b1880a16b017687de |
|
BLAKE2b-256 | 1fd89eab57006ca16a110fc14733d02c10ba5254233d3b890e22eefbd248a4cf |
Hashes for labelme2yolo-0.2.5-py3-none-musllinux_1_2_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b1061acb1405c2d4d6ada11608e8c636bdc3ba148e91fbf4d69c5ef565f1b36 |
|
MD5 | 78223b8ba9173152ef3978a25babf4e2 |
|
BLAKE2b-256 | a5204fd2773ebe4d0312b05218dcc25169a089ec742d0be1d23e75b365cc7596 |
Hashes for labelme2yolo-0.2.5-py3-none-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7397d01942561a0070b8df30c4e3a71882e45d47565d8537d544543536b938f |
|
MD5 | bc3e07e6e489393336bba77396436688 |
|
BLAKE2b-256 | 01984cf2b1ebf60f33335f797e1e0ad65b2c194c31741d2cb72fb269a31607c2 |
Hashes for labelme2yolo-0.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 321c2df606b75eb9cb7b1df76412a85bc1ffac413aefc518782b49d8d1efa99c |
|
MD5 | 4406a3f0f9ab454fee455f290ccfb430 |
|
BLAKE2b-256 | 49007c5a9543bb4b5b1db10648645ed9155936e9bd035a4662b6626cdfc512bb |
Hashes for labelme2yolo-0.2.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 188b608ee15561ac59a6b22ac388974ad64c4477c0bccffb66a380c03da647ad |
|
MD5 | e4cdc6fc904ee8ab241634217faa8b05 |
|
BLAKE2b-256 | a5acc57244d7ab7b32f90bb32bc495cdc578feb27d0fee750e4848b11ddd4d5e |
Hashes for labelme2yolo-0.2.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6914e55d031ccb85eeaf1043c5f99a57a732398cd7ab748cab6bd8056bb406e |
|
MD5 | ce7b250e8b77487a6cee99afc7dd282e |
|
BLAKE2b-256 | 1bc6734ff77fb58a0522208a5cd28581813d3d67dd7fe0f455119acb09d6cc03 |
Hashes for labelme2yolo-0.2.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dfce46f889385486c10f2d1c4f49fa26d334ed60fbd06939daf68dfea5978eb |
|
MD5 | 50fea0023d2c9507ebb0136830d00e7d |
|
BLAKE2b-256 | 4d5395e9b8b12c4a06f61d769d5509db2efe7f4da504b3b2265b48a254768002 |
Hashes for labelme2yolo-0.2.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2289c5badf13716fe6cb463c57130a8ca78338d6cebef905f1b2e71e4d8d7ae |
|
MD5 | e20f8bc36649af53f13fe92c433bba9d |
|
BLAKE2b-256 | 944a34394d6e9f192db0cdfc8390f7106d598465f820cf058e202f57ef7676d4 |
Hashes for labelme2yolo-0.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3d9037fd05955df06a64095878cbc999d81f767a37739a7a2f8ec1d38cec9db |
|
MD5 | 44ba1bce77bbc882317caea41013aa03 |
|
BLAKE2b-256 | 0701afd48571a2b0e7371ef90d46c2416f92f9c09aa2384f2cc08835bfef0da8 |
Hashes for labelme2yolo-0.2.5-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 994b58e973dca4ed136764066404864ea8847b912fb29f6965e4e84f5d7baec7 |
|
MD5 | d751fb52ac874cf6422c7b0fbf0060a5 |
|
BLAKE2b-256 | 1cda206ec5b78b60c8675bae323a9ea9bba879a2fd1a973a7f937e544fb93454 |
Hashes for labelme2yolo-0.2.5-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcafd01064745027547ac33e69dd7162b1a10490b76ac18d5434d707bdb79ab7 |
|
MD5 | bea4d4a06ee3c0ed39914a367e9d1fc7 |
|
BLAKE2b-256 | dd741ad67f4f3c1048680c95aaf07827b1dadb25a5a0aec36cf6f4701f61635c |