Skip to main content

This script converts the JSON format output by LabelMe to the text format required by YOLO serirs.

Project description

Labelme2YOLO

PyPI - Version PyPI - Downloads PYPI - Downloads

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labelme2yolo-0.2.4.tar.gz (14.2 kB view details)

Uploaded Source

Built Distributions

labelme2yolo-0.2.4-py3-none-win_amd64.whl (1.1 MB view details)

Uploaded Python 3 Windows x86-64

labelme2yolo-0.2.4-py3-none-win32.whl (970.2 kB view details)

Uploaded Python 3 Windows x86

labelme2yolo-0.2.4-py3-none-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ x86-64

labelme2yolo-0.2.4-py3-none-musllinux_1_2_i686.whl (1.4 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ i686

labelme2yolo-0.2.4-py3-none-musllinux_1_2_armv7l.whl (1.3 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ ARMv7l

labelme2yolo-0.2.4-py3-none-musllinux_1_2_aarch64.whl (1.4 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ ARM64

labelme2yolo-0.2.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

labelme2yolo-0.2.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.5 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

labelme2yolo-0.2.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

labelme2yolo-0.2.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ i686

labelme2yolo-0.2.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

labelme2yolo-0.2.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

labelme2yolo-0.2.4-py3-none-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

labelme2yolo-0.2.4-py3-none-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded Python 3 macOS 10.12+ x86-64

File details

Details for the file labelme2yolo-0.2.4.tar.gz.

File metadata

  • Download URL: labelme2yolo-0.2.4.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.0

File hashes

Hashes for labelme2yolo-0.2.4.tar.gz
Algorithm Hash digest
SHA256 782cac00a4d12974ac1538e37fc1bd9d3e87f1d5b03657176e928febd51bdd48
MD5 e7cc286d02ee97bb542d5a6656dbae0b
BLAKE2b-256 07db2fae02a069434d4b6c098232b6b89cd0b52bd1b6a36bf005100705222c6a

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2d7633a55c315d34d015d130d00dae079d220f8272f52783a93c3463910e7351
MD5 ed2c4735f631d0cc56ef6bab363e0791
BLAKE2b-256 b5ffb7d419ee568e2ca679041e2d35f757edd428b46f2aeb7e966896da968253

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-win32.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-win32.whl
Algorithm Hash digest
SHA256 1cc71c7dab89e8376136f2287b0fe95788ae29d84b2ce9d8a1e8b6c618e40a5c
MD5 296dff639e916e5de31a7710d5b925b2
BLAKE2b-256 0051176830fe70e37f15ea03dd1c8821605ed699b81b9793f76c2b642ef7a853

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 81192a56b4f062528e8c8dbd8ea2e8efd602ed383ef684b265c5827877e0d9bc
MD5 a2c445736f2f9b168beb6131e423540c
BLAKE2b-256 1c7f12c276b0c2453aa6674cfdf70442660a0f36ed746de2d873badd6438584b

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2a316d969ce2e9694759189f4ddc09503573dc6bce156b56c86ea072ad7674b5
MD5 27ae576e03e5f1ad12d02c75fc93b7a7
BLAKE2b-256 0035b602eebf1636b828e55d9db1300267bb53044936bef2ac5029d7beb068c3

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 cad80bcebb66e510511cd691612541ffa8fdc76addd634f744da437548bad548
MD5 833f675cfc05b282a3769b292cee3529
BLAKE2b-256 5186e57f3418eb70cc5265819046838d0a7c0f603c08d87f26c9888c47f3523c

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9ba642dc2808d260cc76a30cb055a2ac19b4221478257a6d7d2362cbbd923223
MD5 263652fee53dcc626f5d301a628d8029
BLAKE2b-256 0c0a949257ca5f4ea25e8b7fa21bc5a80cf595c023df6429492e870c41eb6c57

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d2fc85d13b246c4adf7fdec7e68d31916d078575200070975fc611cc26ba9fd
MD5 b7d5e82cb5939e71f2a2d90176755a37
BLAKE2b-256 d417d2559c7c488cddee571e034eccc4b1a8ca5e86a9702b596ab385e4a052f6

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 73c04ed5db2b878a04d1e743cd251c29fd11467dd8d83174f6fa142ccaa4c467
MD5 f839208b437b8a71e54989da19a3c736
BLAKE2b-256 e3cea28e806917190b5d7397162359efdd5b0181ab11ef18f0859ae7dc1f3dd7

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 91589bd68235b9c68361fc531834554c670ba0c694445fe226cf0d9bb1437720
MD5 d130490b7715bda07138e0f2abe1a71b
BLAKE2b-256 44e2ff95628c0c0e295ffed1947fdd3c3206d845e2c96d78d46e30aa743ae276

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 d2bd5ad9831f14e3af26e69a843312203add00c83152a227a22a18ac14381095
MD5 da1b3fb16b2bf132f8a5325dec576bb5
BLAKE2b-256 a25387c012b69b39c7a5b82df8472f34d6dabdc91d30a94d6ff6f59a4025eb10

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 61ef3aab2c183f96e23a838d90062e2fc91fb5035db451771f0c0b3e1f465525
MD5 1680eda1411730ad9c60a335a9bfd89e
BLAKE2b-256 0cf8366d6e44205a4b8fb12b423bb37a88ff5c620f9bd415a2604311b14db3cf

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ef4f86cc9826ed2b623f15850f9ee8fef96f81aa9a95c78fc7a6108da868b3aa
MD5 417bd8684c7aadc83dd7e264e7a8db1e
BLAKE2b-256 d33362c9cdf5097d9b051fb18c1f69349c613ea5465e3c3d3c471a2cac3dfcf4

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d535de4a7cd6e24508f0d5e6e7558448751394c5568a46a28e87c696ad812eab
MD5 618385090e2be9d903c9c9689b2eb967
BLAKE2b-256 72d53247e5c862703d6de70729b37df80fdfa7017ab8e8939530f7415803e386

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.2.4-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for labelme2yolo-0.2.4-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b617877a10811574290e7f377ef1f0ee56b99f752a3ee930fb2e85475583ee9c
MD5 a6d20961c3f8457139b4c64c59cd8467
BLAKE2b-256 e69263d68f4cecc009400f98dc237f3c2aaea4a77c9c01a9bf1b538e0837c937

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page