Skip to main content

Labelme2YOLO

Forked from rooneysh/Labelme2YOLO

PyPI - Version 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 v7.0 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.2 means 20% 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, 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

2. Converting JSON files and splitting training and validation datasets by folders

If you have split the LabelMe training dataset and validation dataset on your own, please put these folders under labelme_json_dir as shown below:

/path/to/labelme_json_dir/train/
/path/to/labelme_json_dir/val/

This tool will read the training and validation datasets by folder. You may run the following command to do this:

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

How to build package/wheel

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

License

labelme2yolo is distributed under the terms of the MIT license.

Metadata

Release files for labelme2yolo 0.1.4

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.1.4
File Size Uploaded
labelme2yolo-0.1.4.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for labelme2yolo 0.1.4
File Interpreter ABI Platform
labelme2yolo-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 24.5 kB

Release files / labelme2yolo-0.1.4.tar.gz

Download URL labelme2yolo-0.1.4.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b3ae8a6d9436a802272a354aeec8362eaab575ae2de342528fa4e50c3e14c30a
BLAKE2b-256 checksum
How to use checksums
af14d1d8aeffac97d6e9f244e88c23f2b968d757f8643c1455e0c2999c0bdce5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.2

Release files / labelme2yolo-0.1.4-py3-none-any.whl

Download URL labelme2yolo-0.1.4-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e90360e58f358b6bc2a4c179dbe3c8111582dae87a6b59a3aeaedfe0ec1fdf7
BLAKE2b-256 checksum
How to use checksums
4cb9129fc5fc8b23c875db11b9e3fbe743ad77f1d31d64a8fb3c3ee1ab92b89c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.2

Release history Release notifications | RSS feed

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

This release

0.1.4 This release

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