Skip to content

Commit 43dc25d

Browse files
committed
Add labelImg format data to YOLOV5 format
1 parent fe8f612 commit 43dc25d

30 files changed

+251
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,58 @@
99
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-Apache%202-dfd.svg"></a>
1010
</p>
1111

12+
#### LabelImg标注数据 → YOLOV5格式
13+
-[labelImg](https://github.com/tzutalin/labelImg)库标注的yolo数据格式一键转换为YOLOV5格式数据
14+
- labelImg标注数据目录结构如下(详情参见`dataset/labelImg_dataset`):
15+
```text
16+
labelImg_dataset
17+
├── classes.txt
18+
├── images(13).jpg
19+
├── images(13).txt
20+
├── images(3).jpg
21+
├── images(3).txt
22+
├── images4.jpg
23+
├── images4.txt
24+
├── images5.jpg
25+
├── images5.txt
26+
├── images6.jpg
27+
├── images7.jpg
28+
└── images7.txt
29+
```
30+
- 转换
31+
```shell
32+
python labelImg_2_yolov5.py --src_dir dataset/labelImg_dataset --out_dir dataset/labelImg_dataset_output
33+
```
34+
- `--src_dir`:labelImg标注后所在目录
35+
- `--out_dir`: 转换之后的数据存放位置
36+
- 转换后目录结构(详情参见`dataset/labelImg_dataset_output`):
37+
```text
38+
labelImg_dataset_output/
39+
├── classes.txt
40+
├── images
41+
│   ├── images(13).jpg
42+
│   ├── images(3).jpg
43+
│   ├── images4.jpg
44+
│   ├── images5.jpg
45+
│   └── images7.jpg
46+
├── labels
47+
│   ├── images(13).txt
48+
│   ├── images(3).txt
49+
│   ├── images4.txt
50+
│   ├── images5.txt
51+
│   └── images7.txt
52+
├── non_labels # 这是没有标注txt的图像
53+
│   └── images6.jpg
54+
├── test.txt
55+
├── train.txt
56+
└── val.txt
57+
```
58+
- 可以进一步直接对`dataset/labelImg_dataset_output`目录作转COCO的转换
59+
```shell
60+
python yolov5_2_coco.py --dir_path dataset/lablelImg_dataset_output
61+
```
62+
63+
1264
#### YOLOV5格式数据 → COCO
1365
- 可以将一些背景图像加入到训练中,具体做法是:直接将背景图像放入`backgroud_images`目录即可。
1466
- 转换程序会自动扫描该目录,添加到训练集中,可以无缝集成后续[YOLOX](https://github.com/Megvii-BaseDetection/YOLOX)的训练。
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
stamp
7.68 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0 0.497537 0.395161 0.807882 0.653226
15.9 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0 0.274554 0.205357 0.388393 0.383929
2+
0 0.754464 0.207589 0.375000 0.379464
3+
0 0.504464 0.511161 0.339286 0.343750
4+
0 0.243304 0.792411 0.379464 0.379464
5+
0 0.774554 0.796875 0.370536 0.370536
15.9 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0 0.274554 0.205357 0.388393 0.383929
2+
0 0.754464 0.207589 0.375000 0.379464
3+
0 0.504464 0.511161 0.339286 0.343750
4+
0 0.243304 0.792411 0.379464 0.379464
5+
0 0.774554 0.796875 0.370536 0.370536
7.68 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0 0.497537 0.395161 0.807882 0.653226

0 commit comments

Comments
 (0)