Update README.md
This commit is contained in:
parent
3339f66769
commit
9301f7232c
49
README.md
49
README.md
|
@ -8,6 +8,12 @@
|
||||||
Help converting LabelMe Annotation Tool JSON format to YOLO text file format.
|
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.
|
If you've already marked your segmentation dataset by LabelMe, it's easy to use this tool to help converting to YOLO format dataset.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```console
|
||||||
|
pip install labelme2yolo
|
||||||
|
```
|
||||||
|
|
||||||
## Parameters Explain
|
## Parameters Explain
|
||||||
**--json_dir** LabelMe JSON files folder path.
|
**--json_dir** LabelMe JSON files folder path.
|
||||||
|
|
||||||
|
@ -22,58 +28,53 @@ If you've already marked your segmentation dataset by LabelMe, it's easy to use
|
||||||
### 1. Convert JSON files, split training, validation and test dataset by --val_size and --test_size
|
### 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.
|
Put all LabelMe JSON files under **labelme_json_dir**, and run this python command.
|
||||||
```bash
|
```bash
|
||||||
python labelme2yolo.py --json_dir /home/username/labelme_json_dir/ --val_size 0.15 --test_size 0.15
|
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,
|
Script would generate YOLO format dataset labels and images under different folders, for example,
|
||||||
```bash
|
```bash
|
||||||
/home/username/labelme_json_dir/YOLODataset/labels/train/
|
/path/to/labelme_json_dir/YOLODataset/labels/train/
|
||||||
/home/username/labelme_json_dir/YOLODataset/labels/test/
|
/path/to/labelme_json_dir/YOLODataset/labels/test/
|
||||||
/home/username/labelme_json_dir/YOLODataset/labels/val/
|
/path/to/labelme_json_dir/YOLODataset/labels/val/
|
||||||
/home/username/labelme_json_dir/YOLODataset/images/train/
|
/path/to/labelme_json_dir/YOLODataset/images/train/
|
||||||
/home/username/labelme_json_dir/YOLODataset/images/test/
|
/path/to/labelme_json_dir/YOLODataset/images/test/
|
||||||
/home/username/labelme_json_dir/YOLODataset/images/val/
|
/path/to/labelme_json_dir/YOLODataset/images/val/
|
||||||
|
|
||||||
/home/username/labelme_json_dir/YOLODataset/dataset.yaml
|
/path/to/labelme_json_dir/YOLODataset/dataset.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Convert JSON files, split training and validation dataset by folder
|
### 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,
|
If you already split train dataset and validation dataset for LabelMe by yourself, please put these folder under labelme_json_dir, for example,
|
||||||
```bash
|
```bash
|
||||||
/home/username/labelme_json_dir/train/
|
/path/to/labelme_json_dir/train/
|
||||||
/home/username/labelme_json_dir/val/
|
/path/to/labelme_json_dir/val/
|
||||||
```
|
```
|
||||||
Put all LabelMe JSON files under **labelme_json_dir**.
|
Put all LabelMe JSON files under **labelme_json_dir**.
|
||||||
Script would read train and validation dataset by folder.
|
Script would read train and validation dataset by folder.
|
||||||
Run this python command.
|
Run this python command.
|
||||||
```bash
|
```bash
|
||||||
python labelme2yolo.py --json_dir /home/username/labelme_json_dir/
|
labelme2yolo --json_dir /path/to/labelme_json_dir/
|
||||||
```
|
```
|
||||||
Script would generate YOLO format dataset labels and images under different folders, for example,
|
Script would generate YOLO format dataset labels and images under different folders, for example,
|
||||||
```bash
|
```bash
|
||||||
/home/username/labelme_json_dir/YOLODataset/labels/train/
|
/path/to/labelme_json_dir/YOLODataset/labels/train/
|
||||||
/home/username/labelme_json_dir/YOLODataset/labels/val/
|
/path/to/labelme_json_dir/YOLODataset/labels/val/
|
||||||
/home/username/labelme_json_dir/YOLODataset/images/train/
|
/path/to/labelme_json_dir/YOLODataset/images/train/
|
||||||
/home/username/labelme_json_dir/YOLODataset/images/val/
|
/path/to/labelme_json_dir/YOLODataset/images/val/
|
||||||
|
|
||||||
/home/username/labelme_json_dir/YOLODataset/dataset.yaml
|
/path/to/labelme_json_dir/YOLODataset/dataset.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Convert single JSON file
|
### 3. Convert single JSON file
|
||||||
Put LabelMe JSON file under **labelme_json_dir**. , and run this python command.
|
Put LabelMe JSON file under **labelme_json_dir**. , and run this python command.
|
||||||
```bash
|
```bash
|
||||||
python labelme2yolo.py --json_dir /home/username/labelme_json_dir/ --json_name 2.json
|
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,
|
Script would generate YOLO format text label and image under **labelme_json_dir**, for example,
|
||||||
```bash
|
```bash
|
||||||
/home/username/labelme_json_dir/2.text
|
/path/to/labelme_json_dir/2.text
|
||||||
/home/username/labelme_json_dir/2.png
|
/path/to/labelme_json_dir/2.png
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```console
|
|
||||||
pip install labelme2yolo
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue