Forked from rooneysh/Labelme2YOLO
Labelme2YOLO
Help converting LabelMe Annotation Tool JSON format to YOLO text file format. If you've already marked your segmentation dataset by LabelMe, it's easy to use this tool to help converting to YOLO format dataset.
New
- export data as yolo polygon annotation (for YOLOv5 v7.0 segmentation)
- Now you can choose the output format of the label text. The available options are
plygonandbbox.
Installation
pip install labelme2yolo
Parameters Explain
--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.
How to Use
1. Convert JSON files, split training, validation and test dataset by --val_size and --test_size
Put all LabelMe JSON files under labelme_json_dir, and run this python command.
labelme2yolo --json_dir /path/to/labelme_json_dir/ --val_size 0.15 --test_size 0.15
Script would generate YOLO format dataset labels and images under different folders, for example,
/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. Convert JSON files, split training and validation dataset by folder
If you already split train dataset and validation dataset for LabelMe by yourself, please put these folder under labelme_json_dir, for example,
/path/to/labelme_json_dir/train/
/path/to/labelme_json_dir/val/
Put all LabelMe JSON files under labelme_json_dir. Script would read train and validation dataset by folder. Run this python command.
labelme2yolo --json_dir /path/to/labelme_json_dir/
Script would generate YOLO format dataset labels and images under different folders, for example,
/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
3. Convert single JSON file
Put LabelMe JSON file under labelme_json_dir. , and run this python command.
labelme2yolo --json_dir /path/to/labelme_json_dir/ --json_name 2.json
Script would generate YOLO format text label and image under labelme_json_dir, for example,
/path/to/labelme_json_dir/2.text
/path/to/labelme_json_dir/2.png
How to build package/wheel
- install hatch
- Run the following command:
hatch build
License
labelme2yolo is distributed under the terms of the MIT license.
Metadata
Release files for labelme2yolo 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| labelme2yolo-0.0.9.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| labelme2yolo-0.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / labelme2yolo-0.0.9.tar.gz
| Download URL | labelme2yolo-0.0.9.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c37e7ae208250205c07dbe9b6949df52b0c0cc3579fa578ca6f9c7282c1823e7
|
|
BLAKE2b-256 checksum How to use checksums |
99618504d68b16d4646f3b7aba3f8584670dcf7153094fecb42964defbf80fb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.1
|
Release files / labelme2yolo-0.0.9-py3-none-any.whl
| Download URL | labelme2yolo-0.0.9-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b95ef87cfad2fc609db3eb6baec88c4297aa516bcfed683b4624385ddb68ad4
|
|
BLAKE2b-256 checksum How to use checksums |
463a657a394cd29041b4c381d479f967267059f46753f1afc637d280ae854a17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.1
|