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.3.3.tar.gz (39.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

labelme2yolo-0.3.3-py3-none-win_amd64.whl (2.9 MB view details)

Uploaded Python 3Windows x86-64

labelme2yolo-0.3.3-py3-none-win32.whl (2.6 MB view details)

Uploaded Python 3Windows x86

labelme2yolo-0.3.3-py3-none-musllinux_1_2_x86_64.whl (3.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

labelme2yolo-0.3.3-py3-none-musllinux_1_2_i686.whl (3.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

labelme2yolo-0.3.3-py3-none-musllinux_1_2_armv7l.whl (3.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

labelme2yolo-0.3.3-py3-none-musllinux_1_2_aarch64.whl (3.6 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

labelme2yolo-0.3.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

labelme2yolo-0.3.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

labelme2yolo-0.3.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (4.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

labelme2yolo-0.3.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (3.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

labelme2yolo-0.3.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

labelme2yolo-0.3.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

labelme2yolo-0.3.3-py3-none-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

labelme2yolo-0.3.3-py3-none-macosx_10_12_x86_64.whl (3.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for labelme2yolo-0.3.3.tar.gz
Algorithm Hash digest
SHA256 59d74d03e71a446c242f106c4ab62e58d91b09d940e952a7488f0ea6fa3fdb96
MD5 879b84b13ce330f6c968e10c77343c05
BLAKE2b-256 8416019b654a148cf5e5584c70225220deffb65728144adfff328797bac45fbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 468ff110b2f95188f0e1dcab49bb3c3f217044081b4bede7f78742ceba7d838e
MD5 00955945bbb8c896e4e4ad788c0b0d86
BLAKE2b-256 c35f0429e52bec84a9379ee7b4fbf2528267cfbc932f8e07e78b1d7aa987faab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: labelme2yolo-0.3.3-py3-none-win32.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-win32.whl
Algorithm Hash digest
SHA256 265b88c70fb0769dbc6a57e80c3dba692a0afbe1da196e8b31f63bb57ad5599d
MD5 1e69108fce641fd95945d2b63f9b9274
BLAKE2b-256 aa5238668c442ba8bc28c77623ca3cd27935f75f9aadc3ce2a515740b32cdaa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 12bff4e18907ee5d577df5855d111bf9d375103e22974059e34958cfae48941f
MD5 ab1f0bd1267bf5d9c1c47afc76614288
BLAKE2b-256 712d3b4163f4cdab64e3e13bcc523c5ae4e0b53088b60fa357b2fd963cb7db35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 9b5f3c710c6bc311a0daaa41abfc5e48e52e4a1f196aa2d77a066d1630ad664d
MD5 714272f386664f62ff3a8a1f72d07035
BLAKE2b-256 20f00cb18905261078eaa9790282f8064707feb374441a3aaacec2e3f7f0d230

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 3e4b47213ad0212443175d593043a0bf002a03b03eabf9b3195c340068ba4351
MD5 88919cf0c4fa1005c6873196df9072da
BLAKE2b-256 5bac50520e4572822f796c97889853d97fc5e3be0d1944241224e8bac7129c7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 15157fc5fc4d2eaf2c6fd29813ffd303b4c66bcc1c9f94ee2017fbe7aa528720
MD5 ba44b57e5d477cfbf22a3f0aebb5bfbb
BLAKE2b-256 5dfe2d1c26bd98930f3f65caccfe05c316858c6c0ff2a725a19e29d43f954095

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9594e58782fe95d7b98ab9d58cd4658bee8221918f2ab5eae9ecd470a1c5644
MD5 912c4cbc005bb7ea4924bd6aea5987f7
BLAKE2b-256 a6d913f29b873831eae81dfd455fb34dc13700e9901dfe7dc9b646f437cdcae9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d23243ba6f4733ccf394e1e5fc2fc383f19fc862c8a523f87c425883d5ba8f6e
MD5 a893295594bd9fa748e8d31a6dba38e7
BLAKE2b-256 4d714809650fcb979d30fa045642c815024c715a66c014e6f610526b2eb19e65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 1e4143b1ba3fec3dd834f1ace3f531e06cdae3afbe52fb8decc6ee97d1361473
MD5 a18b34fbc94a7bd46489198bc67106d7
BLAKE2b-256 65b1a1b5de66bf04368bb11052defabee51bdefd38835315a64112fc3b3f4bef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 057958ae2a5488568d4d309332f00c87e94a198ff034cc22f40f55be27e34375
MD5 16b22214c536fa3d3cf7fb91785dfbc3
BLAKE2b-256 ecd9d2e35eb3b9ace73bb2d6029d18c22cf4acaf5f774a423199099d92a4ec89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 2e234b7a0b5f108f5bd8e29123a13dc16acc5fd3becbfb34b7b960fcdb28f4fa
MD5 7e62deb64b7b9be65a75c5ff4a621477
BLAKE2b-256 45edd4dd90ae0ee3cc095c00c77a22ee2ae19b3faa007ba96028b431998d2446

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 552c00ba7c04625e839446ffa4133d1d1466a178ffebc3c7af0fc23e6bad1f26
MD5 8df02d3b2d93c77ccbec62a40bf9f23e
BLAKE2b-256 bb1f1b929d65880bc9b7339da8423e6c05f68d0f210d5b68be54dcd8e6891a58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cde55cd4553dc2033c0d754ac9c8ce3805c315d62675867c5162332488dace7
MD5 7e4b1e0ce3c83c1fff5936e768e08792
BLAKE2b-256 54e428314523d56b87ea682f1ee43d217bd91f8f4becf48bb14a911ab3842c46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7d8041d14ffe076d66057ca1fbbcdba337dcc2fda87c8747dc23a17dfd489b23
MD5 a2e4c1faef6f0077d70f60d9fc43f302
BLAKE2b-256 955d54063d00b9f3bd1698606f56d5381a19cb69d0764881df6eaca787c64b95

See more details on using hashes here.

Supported by

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