glenn-jocher commited on
Commit
33712d6
β€’
1 Parent(s): 2c7c075

Global Wheat Detection 2020 Dataset Auto-Download (#2968)

Browse files

* Create GlobalWheat2020.yaml

* Update and rename visdrone.yaml to VisDrone.yaml

* Update GlobalWheat2020.yaml

data/GlobalWheat2020.yaml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Global Wheat 2020 dataset http://www.global-wheat.com/
2
+ # Train command: python train.py --data GlobalWheat2020.yaml
3
+ # Default dataset location is next to YOLOv5:
4
+ # /parent_folder
5
+ # /datasets/GlobalWheat2020
6
+ # /yolov5
7
+
8
+
9
+ # train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
10
+ train: # 3422 images
11
+ - ../datasets/GlobalWheat2020/images/arvalis_1
12
+ - ../datasets/GlobalWheat2020/images/arvalis_2
13
+ - ../datasets/GlobalWheat2020/images/arvalis_3
14
+ - ../datasets/GlobalWheat2020/images/ethz_1
15
+ - ../datasets/GlobalWheat2020/images/rres_1
16
+ - ../datasets/GlobalWheat2020/images/inrae_1
17
+ - ../datasets/GlobalWheat2020/images/usask_1
18
+
19
+ val: # 748 images (WARNING: train set contains ethz_1)
20
+ - ../datasets/GlobalWheat2020/images/ethz_1
21
+
22
+ test: # 1276
23
+ - ../datasets/GlobalWheat2020/images/utokyo_1
24
+ - ../datasets/GlobalWheat2020/images/utokyo_2
25
+ - ../datasets/GlobalWheat2020/images/nau_1
26
+ - ../datasets/GlobalWheat2020/images/uq_1
27
+
28
+ # number of classes
29
+ nc: 1
30
+
31
+ # class names
32
+ names: [ 'wheat_head' ]
33
+
34
+
35
+ # download command/URL (optional) --------------------------------------------------------------------------------------
36
+ download: |
37
+ from utils.general import download, Path
38
+
39
+ # Download
40
+ dir = Path('../datasets/GlobalWheat2020') # dataset directory
41
+ urls = ['https://zenodo.org/record/4298502/files/global-wheat-codalab-official.zip',
42
+ 'https://github.com/ultralytics/yolov5/releases/download/v1.0/GlobalWheat2020_labels.zip']
43
+ download(urls, dir=dir)
44
+
45
+ # Make Directories
46
+ for p in 'annotations', 'images', 'labels':
47
+ (dir / p).mkdir(parents=True, exist_ok=True)
48
+
49
+ # Move
50
+ for p in 'arvalis_1', 'arvalis_2', 'arvalis_3', 'ethz_1', 'rres_1', 'inrae_1', 'usask_1', \
51
+ 'utokyo_1', 'utokyo_2', 'nau_1', 'uq_1':
52
+ (dir / p).rename(dir / 'images' / p) # move to /images
53
+ f = (dir / p).with_suffix('.json') # json file
54
+ if f.exists():
55
+ f.rename((dir / 'annotations' / p).with_suffix('.json')) # move to /annotations
data/{visdrone.yaml β†’ VisDrone.yaml} RENAMED
@@ -1,5 +1,5 @@
1
  # VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset
2
- # Train command: python train.py --data visdrone.yaml
3
  # Default dataset location is next to YOLOv5:
4
  # /parent_folder
5
  # /VisDrone
@@ -20,11 +20,7 @@ names: [ 'pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', '
20
 
21
  # download command/URL (optional) --------------------------------------------------------------------------------------
22
  download: |
23
- import os
24
- from pathlib import Path
25
-
26
- from utils.general import download
27
-
28
 
29
  def visdrone2yolo(dir):
30
  from PIL import Image
 
1
  # VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset
2
+ # Train command: python train.py --data VisDrone.yaml
3
  # Default dataset location is next to YOLOv5:
4
  # /parent_folder
5
  # /VisDrone
 
20
 
21
  # download command/URL (optional) --------------------------------------------------------------------------------------
22
  download: |
23
+ from utils.general import download, os, Path
 
 
 
 
24
 
25
  def visdrone2yolo(dir):
26
  from PIL import Image