|
a |
|
b/data/GlobalWheat2020.yaml |
|
|
1 |
# YOLOv5 🚀 by Ultralytics, AGPL-3.0 license |
|
|
2 |
# Global Wheat 2020 dataset http://www.global-wheat.com/ by University of Saskatchewan |
|
|
3 |
# Example usage: python train.py --data GlobalWheat2020.yaml |
|
|
4 |
# parent |
|
|
5 |
# ├── yolov5 |
|
|
6 |
# └── datasets |
|
|
7 |
# └── GlobalWheat2020 ← downloads here (7.0 GB) |
|
|
8 |
|
|
|
9 |
|
|
|
10 |
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..] |
|
|
11 |
path: ../datasets/GlobalWheat2020 # dataset root dir |
|
|
12 |
train: # train images (relative to 'path') 3422 images |
|
|
13 |
- images/arvalis_1 |
|
|
14 |
- images/arvalis_2 |
|
|
15 |
- images/arvalis_3 |
|
|
16 |
- images/ethz_1 |
|
|
17 |
- images/rres_1 |
|
|
18 |
- images/inrae_1 |
|
|
19 |
- images/usask_1 |
|
|
20 |
val: # val images (relative to 'path') 748 images (WARNING: train set contains ethz_1) |
|
|
21 |
- images/ethz_1 |
|
|
22 |
test: # test images (optional) 1276 images |
|
|
23 |
- images/utokyo_1 |
|
|
24 |
- images/utokyo_2 |
|
|
25 |
- images/nau_1 |
|
|
26 |
- images/uq_1 |
|
|
27 |
|
|
|
28 |
# Classes |
|
|
29 |
names: |
|
|
30 |
0: wheat_head |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
# Download script/URL (optional) --------------------------------------------------------------------------------------- |
|
|
34 |
download: | |
|
|
35 |
from utils.general import download, Path |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
# Download |
|
|
39 |
dir = Path(yaml['path']) # dataset root dir |
|
|
40 |
urls = ['https://zenodo.org/record/4298502/files/global-wheat-codalab-official.zip', |
|
|
41 |
'https://github.com/ultralytics/yolov5/releases/download/v1.0/GlobalWheat2020_labels.zip'] |
|
|
42 |
download(urls, dir=dir) |
|
|
43 |
|
|
|
44 |
# Make Directories |
|
|
45 |
for p in 'annotations', 'images', 'labels': |
|
|
46 |
(dir / p).mkdir(parents=True, exist_ok=True) |
|
|
47 |
|
|
|
48 |
# Move |
|
|
49 |
for p in 'arvalis_1', 'arvalis_2', 'arvalis_3', 'ethz_1', 'rres_1', 'inrae_1', 'usask_1', \ |
|
|
50 |
'utokyo_1', 'utokyo_2', 'nau_1', 'uq_1': |
|
|
51 |
(dir / p).rename(dir / 'images' / p) # move to /images |
|
|
52 |
f = (dir / p).with_suffix('.json') # json file |
|
|
53 |
if f.exists(): |
|
|
54 |
f.rename((dir / 'annotations' / p).with_suffix('.json')) # move to /annotations |