Skip to content

Commit db437fd

Browse files
committed
Update yolov5 yaml to coco
1 parent b76329f commit db437fd

File tree

13 files changed

+143
-89
lines changed

13 files changed

+143
-89
lines changed

README.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#### darknet格式数据→COCO
2-
- darknet训练数据目录结构(详情参见`dataset/darknet`):
3-
```text
4-
darknet
5-
├── class.names
6-
├── gen_config.data
7-
├── gen_train.txt
8-
├── gen_valid.txt
9-
└── images
10-
├── train
11-
└── valid
12-
```
13-
14-
- 转换
15-
```shell
16-
python darknet2coco.py --data_path dataset/darknet/gen_config.data
17-
```
18-
191
#### YOLOV5格式数据→COCO
202
- 值得一提的是,由标注软件[labelImg](https://github.com/tzutalin/labelImg)标注所得yolo格式数据,也可由该脚本做转换。前提是满足以下数据目录结构。
213
- YOLOV5训练格式目录结构(详情参见`dataset/YOLOV5`):
@@ -52,16 +34,45 @@
5234
5335
- YOLOV5 yaml 数据文件需要包含:
5436
```text
55-
YOLOV5 yaml
56-
├── path(str, the root path)
57-
├── train(Train sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..])
58-
├── val(val sets, similar as train)
59-
37+
YOLOV5_yaml/
38+
├── images
39+
│   ├── train
40+
│   │   ├── images(13).jpg
41+
│   │   └── images(3).jpg
42+
│   └── val
43+
│   ├── images(13).jpg
44+
│   └── images(3).jpg
45+
├── labels
46+
│   ├── train
47+
│   │   ├── images(13).txt
48+
│   │   └── images(3).txt
49+
│   └── val
50+
│   ├── images(13).txt
51+
│   └── images(3).txt
52+
└── sample.yaml
6053
```
6154
6255
- 转换
6356
```shell
64-
python yolov5_cfgfile_2_coco.py --cfg_file dataset/sample.yaml
57+
python yolov5_yaml_2_coco.py --yaml_path dataset/YOLOV5_yaml/sample.yaml
58+
```
59+
60+
#### darknet格式数据→COCO
61+
- darknet训练数据目录结构(详情参见`dataset/darknet`):
62+
```text
63+
darknet
64+
├── class.names
65+
├── gen_config.data
66+
├── gen_train.txt
67+
├── gen_valid.txt
68+
└── images
69+
├── train
70+
└── valid
71+
```
72+
73+
- 转换
74+
```shell
75+
python darknet2coco.py --data_path dataset/darknet/gen_config.data
6576
```
6677

6778
#### 可视化COCO格式标注格式
7.68 KB
Loading
15.9 KB
Loading
7.68 KB
Loading
15.9 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
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
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
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

dataset/YOLOV5_yaml/sample.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# 该配置文件和yolov5项目使用的一样
2+
3+
# dataset root dir
4+
path: dataset/YOLOV5_yaml
5+
train: # train images (relative to 'path')
6+
- images/train
7+
val: # val images (relative to 'path')
8+
- images/val
9+
10+
# Classes
11+
nc: 1 # number of classes
12+
names: ['stamp'] # class names

0 commit comments

Comments
 (0)