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.2.tar.gz (38.9 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.2-py3-none-win_amd64.whl (2.9 MB view details)

Uploaded Python 3Windows x86-64

labelme2yolo-0.3.2-py3-none-win32.whl (2.7 MB view details)

Uploaded Python 3Windows x86

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

labelme2yolo-0.3.2-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.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

labelme2yolo-0.3.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (4.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

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

Uploaded Python 3manylinux: glibc 2.17+ i686

labelme2yolo-0.3.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

labelme2yolo-0.3.2-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.2.tar.gz.

File metadata

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

File hashes

Hashes for labelme2yolo-0.3.2.tar.gz
Algorithm Hash digest
SHA256 d669d2a0c1c722189e4d801085ab46434d196df95a3133887959bc063745a49e
MD5 4c09abebcd5d0b27224aaa34fb5a3bde
BLAKE2b-256 0b076b6bd352fc33beafb4dde7606c15e2b0fe7f4f53f251ba297ded1dd56e95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 764b8fd738785dde856006ee28f43e7201c66ecd0f89133100d97299a52c02ff
MD5 8862e50a7d91dc3e3312f2b6320a05c9
BLAKE2b-256 b08d4977b0fb7c43a8f11c65685a3ef12ef9be2dc21dbecf1484dace322c9a83

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-win32.whl
Algorithm Hash digest
SHA256 8050f13a78fa1d4176a6fbee1a305b00c61b4375aae3808471f50f9cbb5b7a04
MD5 47595e7e32ec756ada9f19ce9d16c0d2
BLAKE2b-256 7ac076f0af50147ba952432e1168989b24b93b29c10ae0e459842e5f70640641

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b3a44df6a53869975ebc62fd8279a7d98290f1d73c2e09a6b6fa72d24f7b6a1d
MD5 7b772675ada51bc1ba83bacc3cc7fb0f
BLAKE2b-256 fafd9fe2945497d4b1381f7e62ebb675c6c60d4927d9bc00399b0f2fd703cc41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 f4be2536a85515419d90b2562a6b1a56b273de81653414d74f121dae78b6cd17
MD5 42c7d90ef8cce5fed892bd178bf133f6
BLAKE2b-256 3d908fb539dc96be4701a998a2ff6d3904e4a98032e8b8bcdfb6ea031e67026d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 bf06c2ac2e078e799610d5343a66d16b1abc8d4beaacc90ddea33f1b11319151
MD5 b4b9cfb8646f2eaec8696f206c2e3c16
BLAKE2b-256 f631fc9187ce2f57f27d9de170ce5e448062f576d1b647fba76f89a8f1005736

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3ef526c932865ef0051d4ce7334f31cbef686125b4ce72556d1870257b1b324d
MD5 3c91918fac0502f909ca3dc4c36fbb7a
BLAKE2b-256 ae5b08af5d18a46db7a212f661ec4995697f851087651e931275a1815929eaf8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 906cabf44c289e30856a1b0844601e618125f57d2fd06ae9dce3ecaaad73b167
MD5 16e1c29b3a2966f5354f3d3014076b2f
BLAKE2b-256 1ed9ea4b47582dab1e32286fee87c16b76ce144385c6b5b2b1ab72859ddafbe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 76106aae313b0a57e297c232ea538c44245ca6ee5885b7fb1c1445a6cd3a601f
MD5 ef2fbb02b34198e6b3ffa659355aa989
BLAKE2b-256 c090b5ae34e8b003411edc5440e9b970b785fdba7a1205dc666dc680874fb89f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d0bd8bb97d529ae50bbef234bd3934aed50d50a977359cfa28bbe5e191e2ae99
MD5 b3995df73d8f70e898dce43e6e571811
BLAKE2b-256 cae41391951cbf17eb3e3597c75c98fd60a62fc9af1facb09447cb747aac1361

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 1621ad8ce4a97c7a3f6fda12b564e359e10ddac3ff501f232994ae9396b6b79d
MD5 bd04a09e49df587097dab08853f0e4d9
BLAKE2b-256 dcb2772554ee003b14f8705876176e6712d7691f1d2fd6e9ba7d344446951a2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 ecf1bb47bbf90560ccc5c8481b44bbcee82949675a462ef801b9969dce4496bf
MD5 89ec3f6577fe933b0725c1e01b35f620
BLAKE2b-256 0750bf031b4d78c145dcc2353d476d2cbd286e29279ee8aef4c987c6d614a8ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e56692da363d6043eb48e740f81f2736e79c21fcf3eb6a9fd84bc14256b4d46e
MD5 b3c44ec0d246e7d151563c64130eec19
BLAKE2b-256 e0ada90d05cabeac1d0b70deb5c81d99c30f0d39fbe5063dfda8e802adbf50df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9157ab2d9afadff327e6cb554af5491003a9426810fceeb2d2c2e309e29d9c3e
MD5 dc949738167b74543888ab03039b6f9a
BLAKE2b-256 de077bebbc85c84c2a754248c7d2106407e2a41a9bedca83b55a217cc25387c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for labelme2yolo-0.3.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e973fb7fd5e5ce22e2bab72e59dcc988b9b93443477a8d01aa4c96874c0b8742
MD5 b251f517a0a24ec2b193e90ba2f48370
BLAKE2b-256 9ddb227481f54f394454d30ee6f34d48c271b47b634475de653b594bb363cff7

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