Skip to main content

Labelme2YOLO

PyPI - Version PyPI - Downloads PYPI - Downloads PyPI - Python Version Codacy Badge

Labelme2YOLO is a powerful tool for converting LabelMe's JSON format to YOLOv5 dataset format. This tool can also be used for YOLOv5/YOLOv8 segmentation datasets, if you have already made your segmentation dataset with LabelMe, it is easy to use this tool to help convert to YOLO format dataset.

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

Installation

pip install labelme2yolo

Arguments

--json_dir LabelMe JSON files folder path.

--val_size (Optional) Validation dataset size, for example 0.2 means 20% for validation.

--test_size (Optional) Test dataset size, for example 0.1 means 10% for Test.

--json_name (Optional) Convert single LabelMe JSON file.

--output_format (Optional) The output format of label.

--label_list (Optional) The pre-assigned category labels.

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

  1. install hatch
  2. Run the following command:
hatch build

License

Forked from rooneysh/Labelme2YOLO

labelme2yolo is distributed under the terms of the MIT license.

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

Uploaded Source

Built Distribution

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

labelme2yolo-0.1.7-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: labelme2yolo-0.1.7.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.25.2

File hashes

Hashes for labelme2yolo-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e0d0a86591d6958ab27a084f8c4fc32b4d8148469b2a77e8fc97212c5c2027c1
MD5 73de371418d07c74ea457080c20c6aaa
BLAKE2b-256 250c2dccf8124664d6a010cbd56d4d149cdf36c288b526fa88300396d6504264

See more details on using hashes here.

File details

Details for the file labelme2yolo-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: labelme2yolo-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.25.2

File hashes

Hashes for labelme2yolo-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 03d15179ab37fe5612ea5ce246e0f4191bdac1fe37977ca5dc3cc3696726e9b2
MD5 d73cf31297d6758911d3dd5df4f3b632
BLAKE2b-256 b855c16a538c5a4999b178c3c40a35760cb7817d9548977005e3aea6bc6e68d1

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

15 files

0.3.3

15 files

0.3.2

15 files

0.3.1

15 files

0.3.0

15 files

0.2.5

15 files

0.2.4

15 files

0.2.3

15 files

0.2.2

15 files

0.2.1

15 files

0.2.0

15 files

This release

0.1.7 This release

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.2

2 files

0.0.1

2 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