Skip to main content

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. Repeat the flag to convert multiple directories in one run (requires --output_dir).

-o, --output_dir <OUTPUT_DIR> Output directory for the converted dataset [default: <json_dir>/YOLODataset]. Required when multiple --json_dir values are given.

--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

3. Converting multiple directories into one dataset

Pass --json_dir multiple times to combine several source directories. An explicit --output_dir is required in this case:

labelme2yolo -d /path/to/src-a/ -d /path/to/src-b/ -o /path/to/output/

Files with the same name in different source directories are kept apart automatically.

How to build package/wheel

pip install maturin
maturin develop

Release files for labelme2yolo 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for labelme2yolo 0.4.0
File Size Uploaded
labelme2yolo-0.4.0.tar.gz 44.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for labelme2yolo 0.4.0
File
labelme2yolo-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
labelme2yolo-0.4.0-py3-none-win32.whl Python 3 none Windows x86-32 Details
labelme2yolo-0.4.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
labelme2yolo-0.4.0-py3-none-musllinux_1_2_i686.whl Python 3 none Linux musl 1.2+ x86-32 Details
labelme2yolo-0.4.0-py3-none-musllinux_1_2_armv7l.whl Python 3 none Linux musl 1.2+ ARMv7l Details
labelme2yolo-0.4.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
labelme2yolo-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
labelme2yolo-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl Python 3 none Linux glibc 2.17+ IBM System/390x Details
labelme2yolo-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl Python 3 none Linux glibc 2.17+ PowerPC 64-le Details
labelme2yolo-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl Python 3 none Linux glibc 2.17+ x86-32 Details
labelme2yolo-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl Python 3 none Linux glibc 2.17+ ARMv7l Details
labelme2yolo-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
labelme2yolo-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
labelme2yolo-0.4.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 49.5 MB

Release files / labelme2yolo-0.4.0.tar.gz

Download URL labelme2yolo-0.4.0.tar.gz
Size 44.3 kB
Tags Source
SHA-256 checksum
How to use checksums
350af28128534e7cb3313f2e036e463b9ec54a538a96b46ce9e0b532958d1b3e
BLAKE2b-256 checksum
How to use checksums
894aa72548f448f4a9657f3095b6a540b7ffc4ce01afd8193df47b66fc7065b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-win_amd64.whl

Download URL labelme2yolo-0.4.0-py3-none-win_amd64.whl
Size 2.9 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6753f469363bbdc3f1fd8d2a62900a5534d626e1f16a16357405abd6c049236d
BLAKE2b-256 checksum
How to use checksums
d3321fb14b2cd26ae5e9aa746184ce59dee3320b0e159335c92145e5c2d0e91d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-win32.whl

Download URL labelme2yolo-0.4.0-py3-none-win32.whl
Size 2.6 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
a94ae65789cf297d131c09aa5c705dff53e5cb77acabb5ee5800696bb8cde79d
BLAKE2b-256 checksum
How to use checksums
67d711663554687ff24c1ed91414550c7271353dd03933d9e14305fa7275ba0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-musllinux_1_2_x86_64.whl

Download URL labelme2yolo-0.4.0-py3-none-musllinux_1_2_x86_64.whl
Size 3.8 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
89b80cab4332e1e1627aa8fde705b0b269893259a7a0b2270c412abdf8eea970
BLAKE2b-256 checksum
How to use checksums
dcca719db129a38e76d301801d8fbf8bbf75ddf900a11f587b7ae9c6bdd457db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-musllinux_1_2_i686.whl

Download URL labelme2yolo-0.4.0-py3-none-musllinux_1_2_i686.whl
Size 3.8 MB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
642180946c84fdedaae22312a8c8352580946a9c02ee2dc93b540c0700ce389b
BLAKE2b-256 checksum
How to use checksums
5f93fb16a5f683658c144eb5088e7cffd75edeb1ec1704009b6b1f6d6d5a0241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-musllinux_1_2_armv7l.whl

Download URL labelme2yolo-0.4.0-py3-none-musllinux_1_2_armv7l.whl
Size 3.6 MB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
ca7e33faf0b055a4efe87d093f80287b2a6497056412e3249cb4df879cba7dc6
BLAKE2b-256 checksum
How to use checksums
c6dfc366168f08e288c856183c19ecdc802e837fc57ad8793231d273df758607
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-musllinux_1_2_aarch64.whl

Download URL labelme2yolo-0.4.0-py3-none-musllinux_1_2_aarch64.whl
Size 3.6 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
fb650bb5a3cf737cefb60f98e352aa92231bd7ba211349916f25026d062f6a21
BLAKE2b-256 checksum
How to use checksums
9c1e6a83288100f4a13e6512f4dd1c2e0508e6eb6e4ca6086e9d251e09fce4e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL labelme2yolo-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.7 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
317f96f817d2d035ee782b3b72208f6d4b753a697dca44ee94f8550b06350baa
BLAKE2b-256 checksum
How to use checksums
dfe5d444eb5e5d587587b1af1a013e23f3295af6742fa3c4c7642b14b4ac0d70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL labelme2yolo-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 3.7 MB
Tags Linux glibc 2.17+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
950ca24bee84d755beeb1e5dc2b9ce5df09f6e535e1812699a8b52f41d0800c5
BLAKE2b-256 checksum
How to use checksums
8eda33f62163b137d98e83b2886b6a96f21604dfb42419eb51b77d2978c3e7e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL labelme2yolo-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 4.2 MB
Tags Linux glibc 2.17+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
d0954db92d0f40c045c6615e867a681e411db8e100be31cf1d5a7829b03e6176
BLAKE2b-256 checksum
How to use checksums
610f52e0aba46e0f0c05833c9f03c7d8fe72ef9870ae8bd40d34d664c362561e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL labelme2yolo-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 3.9 MB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
72557f3d64fefce95d77ed5e4f4d8db603f0920bed26a60095d0dbd8bc124af9
BLAKE2b-256 checksum
How to use checksums
c4181c1915c06e21961e91bdf737cf44d705aeb38c37440ba59929b36e0b6c11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL labelme2yolo-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 3.5 MB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
45c5e3e3b739ef9a8c90291346f6e0b988f7c3b2f7d3d41a126f1fd7c75e91e9
BLAKE2b-256 checksum
How to use checksums
e893650bb7bb2199ad0f6cfcfbab2531cf23cfabc6c4f03345bcff9f6770619a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL labelme2yolo-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.6 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
014c3fb2a40bbfdf62436d16a1f8d478387606a51313213135dc4f929fb5533d
BLAKE2b-256 checksum
How to use checksums
9377abda1396b18418a22d0b37bf91c02d85cad42da1d101c36ddf6eb92fa238
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-macosx_11_0_arm64.whl

Download URL labelme2yolo-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 3.2 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6a007b597770d27a892854bfb0b2f3baba2d2abef3cac643c07a4957f4bcc9f2
BLAKE2b-256 checksum
How to use checksums
c301596abd039527dd89f6dcba530952f87cc69cd7b786de0836f9c7809d08ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release files / labelme2yolo-0.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL labelme2yolo-0.4.0-py3-none-macosx_10_12_x86_64.whl
Size 3.4 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8757b30a7ecbeecad8944fbc63f7df6c8048e4fb299a3f9e5ed8b17dccfb5139
BLAKE2b-256 checksum
How to use checksums
cf424f497051dd451970b1b2aca7978d515c944b10095912e0e1e9d2600275ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.14.1

Release history Release notifications | RSS feed

This release

0.4.0 This release

15 release files

0.3.2

15 release files

0.3.0

15 release files

0.2.5

15 release files

0.2.4

15 release files

0.2.3

15 release files

0.2.2

15 release files

0.2.1

15 release files

0.2.0

15 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page