Go to file
dependabot[bot] b151acd61c
Update pillow requirement from <10.3,>=9.2 to >=9.2,<10.4 (#52)
Updates the requirements on [pillow](https://github.com/python-pillow/Pillow) to permit the latest version.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.2.0...10.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 18:45:16 +08:00
.github update readme 2024-02-18 09:32:25 +08:00
src/labelme2yolo update version (#51) 2024-03-25 20:59:57 +08:00
tests make labelme2yolo package 2022-07-29 17:26:24 +08:00
.gitignore add output_format option 2023-03-16 13:48:24 +08:00
.pylintrc update to version 0.1.2 (#26) 2023-06-02 16:16:45 +08:00
LICENSE Create LICENSE 2022-07-25 16:12:43 +08:00
README.md Update README.md (#46) 2024-03-04 21:33:12 +08:00
pyproject.toml Update pillow requirement from <10.3,>=9.2 to >=9.2,<10.4 (#52) 2024-04-08 18:45:16 +08:00
requirements.txt replace tqdm with rich (#43) 2024-02-28 23:53:11 +08:00

README.md

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.