1- ** Forked from [ rooneysh/Labelme2YOLO] ( https://github.com/rooneysh/Labelme2YOLO ) **
2-
31# Labelme2YOLO
42
3+ ** Forked from [ rooneysh/Labelme2YOLO] ( https://github.com/rooneysh/Labelme2YOLO ) **
4+
55[ ![ PyPI - Version] ( https://img.shields.io/pypi/v/labelme2yolo.svg )] ( https://pypi.org/project/labelme2yolo )
66![ PyPI - Downloads] ( https://img.shields.io/pypi/dm/labelme2yolo?style=flat )
77[ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/labelme2yolo.svg )] ( https://pypi.org/project/labelme2yolo )
8- [ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/12122fe86f8643c4aa5667c20d528f61 )] ( https://www.codacy.com/gh/GreatV/labelme2yolo/dashboard?utm_source=github.com& amp ; utm_medium=referral& amp ; utm_content=GreatV/labelme2yolo& amp ; utm_campaign=Badge_Grade )
8+ [ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/12122fe86f8643c4aa5667c20d528f61 )] ( https://www.codacy.com/gh/GreatV/labelme2yolo/dashboard?utm_source=github.com\& utm_medium=referral\& utm_content=GreatV/labelme2yolo\& utm_campaign=Badge_Grade )
99
10- Help converting LabelMe Annotation Tool JSON format to YOLO text file format.
10+ Help converting LabelMe Annotation Tool JSON format to YOLO text file format.
1111If you've already marked your segmentation dataset by LabelMe, it's easy to use this tool to help converting to YOLO format dataset.
1212
13- ---------
14-
1513## New
16- - export data as yolo polygon annotation (for YOLOv5 v7.0 segmentation)
17- - Now you can choose the output format of the label text. The available options are ` plygon ` and ` bbox ` .
14+
15+ * export data as yolo polygon annotation (for YOLOv5 v7.0 segmentation)
16+ * Now you can choose the output format of the label text. The available options are ` plygon ` and ` bbox ` .
17+
1818## Installation
1919
2020``` console
2121pip install labelme2yolo
2222```
2323
2424## Parameters Explain
25- ** --json_dir** LabelMe JSON files folder path.
2625
27- ** --val_size (Optional)** Validation dataset size, for example 0.2 means 20% for validation.
26+ ** --json\_ dir** LabelMe JSON files folder path.
27+
28+ ** --val\_ size (Optional)** Validation dataset size, for example 0.2 means 20% for validation.
2829
29- ** --test_size (Optional)** Test dataset size, for example 0.2 means 20% for Test.
30+ ** --test \_ size (Optional)** Test dataset size, for example 0.2 means 20% for Test.
3031
31- ** --json_name (Optional)** Convert single LabelMe JSON file.
32+ ** --json \_ name (Optional)** Convert single LabelMe JSON file.
3233
33- ** --output_format (Optional)** The output format of label.
34+ ** --output \_ format (Optional)** The output format of label.
3435
3536## How to Use
3637
37- ### 1. Convert JSON files, split training, validation and test dataset by --val_size and --test_size
38- Put all LabelMe JSON files under ** labelme_json_dir** , and run this python command.
38+ ### 1. Convert JSON files, split training, validation and test dataset by --val\_ size and --test\_ size
39+
40+ Put all LabelMe JSON files under ** labelme\_ json\_ dir** , and run this python command.
41+
3942``` bash
4043labelme2yolo --json_dir /path/to/labelme_json_dir/ --val_size 0.15 --test_size 0.15
4144```
45+
4246Script would generate YOLO format dataset labels and images under different folders, for example,
47+
4348``` bash
4449/path/to/labelme_json_dir/YOLODataset/labels/train/
4550/path/to/labelme_json_dir/YOLODataset/labels/test/
@@ -52,18 +57,24 @@ Script would generate YOLO format dataset labels and images under different fold
5257```
5358
5459### 2. Convert JSON files, split training and validation dataset by folder
55- If you already split train dataset and validation dataset for LabelMe by yourself, please put these folder under labelme_json_dir, for example,
60+
61+ If you already split train dataset and validation dataset for LabelMe by yourself, please put these folder under labelme\_ json\_ dir, for example,
62+
5663``` bash
5764/path/to/labelme_json_dir/train/
5865/path/to/labelme_json_dir/val/
5966```
60- Put all LabelMe JSON files under ** labelme_json_dir** .
67+
68+ Put all LabelMe JSON files under ** labelme\_ json\_ dir** .
6169Script would read train and validation dataset by folder.
6270Run this python command.
71+
6372``` bash
6473labelme2yolo --json_dir /path/to/labelme_json_dir/
6574```
75+
6676Script would generate YOLO format dataset labels and images under different folders, for example,
77+
6778``` bash
6879/path/to/labelme_json_dir/YOLODataset/labels/train/
6980/path/to/labelme_json_dir/YOLODataset/labels/val/
@@ -74,11 +85,15 @@ Script would generate YOLO format dataset labels and images under different fold
7485```
7586
7687### 3. Convert single JSON file
77- Put LabelMe JSON file under ** labelme_json_dir** . , and run this python command.
88+
89+ Put LabelMe JSON file under ** labelme\_ json\_ dir** . , and run this python command.
90+
7891``` bash
7992labelme2yolo --json_dir /path/to/labelme_json_dir/ --json_name 2.json
8093```
81- Script would generate YOLO format text label and image under ** labelme_json_dir** , for example,
94+
95+ Script would generate YOLO format text label and image under ** labelme\_ json\_ dir** , for example,
96+
8297``` bash
8398/path/to/labelme_json_dir/2.text
8499/path/to/labelme_json_dir/2.png
0 commit comments