# 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.
## Parameters Explain
**--json_dir** LabelMe JSON files folder path.
**--val_size (Optional)** Validation dataset size, for example 0.2 means 20% for validation and 80% for training. Default value is 0.1 .
**--json_name (Optional)** Convert single LabelMe JSON file.
**--seg (Optional)** Convert to [YOLOv5 v7.0](https://github.com/ultralytics/yolov5/tree/v7.0#segmentation--new) instance segmentation dataset.
## How to Use
### 1. Convert JSON files, split training and validation dataset by --val_size
Put all LabelMe JSON files under **labelme_json_dir**, and run this python command.
```bash
python labelme2yolo.py --json_dir /home/username/labelme_json_dir/ --val_size 0.2
```
Script would generate YOLO format dataset labels and images under different folders, for example,
```bash
# when specifying `--seg', "YOLODataset" will be "YOLODataset_seg"
/home/username/labelme_json_dir/YOLODataset/labels/train/
/home/username/labelme_json_dir/YOLODataset/labels/val/
/home/username/labelme_json_dir/YOLODataset/images/train/
/home/username/labelme_json_dir/YOLODataset/images/val/
/home/username/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,
```bash
/home/username/labelme_json_dir/train/
/home/username/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.
```bash
python labelme2yolo.py --json_dir /home/username/labelme_json_dir/
```
Script would generate YOLO format dataset labels and images under different folders, for example,
```bash
# when specifying `--seg', "YOLODataset" will be "YOLODataset_seg"
/home/username/labelme_json_dir/YOLODataset/labels/train/
/home/username/labelme_json_dir/YOLODataset/labels/val/
/home/username/labelme_json_dir/YOLODataset/images/train/
/home/username/labelme_json_dir/YOLODataset/images/val/
/home/username/labelme_json_dir/YOLODataset/dataset.yaml
```
### 3. Convert single JSON file
Put LabelMe JSON file under **labelme_json_dir**. , and run this python command.
```bash
python labelme2yolo.py --json_dir /home/username/labelme_json_dir/ --json_name 2.json
```
Script would generate YOLO format text label and image under **labelme_json_dir**, for example,
```bash
/home/username/labelme_json_dir/2.text
/home/username/labelme_json_dir/2.png
```
##
Only tested on Centos 7/Python 3.6 environment.

徐浪老师
- 粉丝: 9379
最新资源
- Java仓库软件总体设计说明书.doc
- webcare用户手册.docx
- arduino多点网络温度采集项目.doc
- Excel表格通用模板:进销存出入库管理系统(带库存预警-对账-盘点报表).xlsx
- C语言-形位公差.ppt
- SK培训资料单片机介绍.ppt
- 百合酒店网站建设方案.doc
- GB T 17645.1-2001 工业自动化系统与集成 零件库 第1部分 综述与基本原理.pdf
- 第一章-网络检索基础及检索工具的利用.ppt
- 毕业设计基于单片机的可编程作息时间控制器设计样本.doc
- 第1章--认识微信小程序.pptx
- JB T 9233.4-1999 工业自动化仪表通用试验方法.位置影响.pdf
- 电力系统自动化技术毕业设计PLC与变频器集成控制的恒模板.doc
- 2023年操作系统填空名词解释简答题题库.docx
- IN成都20移动电子商务合作方案new.ppt
- PLC与变频器工程应用讲座.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


