From 33712d6dd0cc54e28b97d56cb999aa050a1c94ef Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 28 Apr 2021 20:11:02 +0200 Subject: [PATCH] Global Wheat Detection 2020 Dataset Auto-Download (#2968) * Create GlobalWheat2020.yaml * Update and rename visdrone.yaml to VisDrone.yaml * Update GlobalWheat2020.yaml --- data/GlobalWheat2020.yaml | 55 +++++++++++++++++++++++++++ data/{visdrone.yaml => VisDrone.yaml} | 8 +--- 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 data/GlobalWheat2020.yaml rename data/{visdrone.yaml => VisDrone.yaml} (95%) diff --git a/data/GlobalWheat2020.yaml b/data/GlobalWheat2020.yaml new file mode 100644 index 000000000000..b6f812d70383 --- /dev/null +++ b/data/GlobalWheat2020.yaml @@ -0,0 +1,55 @@ +# Global Wheat 2020 dataset http://www.global-wheat.com/ +# Train command: python train.py --data GlobalWheat2020.yaml +# Default dataset location is next to YOLOv5: +# /parent_folder +# /datasets/GlobalWheat2020 +# /yolov5 + + +# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/] +train: # 3422 images + - ../datasets/GlobalWheat2020/images/arvalis_1 + - ../datasets/GlobalWheat2020/images/arvalis_2 + - ../datasets/GlobalWheat2020/images/arvalis_3 + - ../datasets/GlobalWheat2020/images/ethz_1 + - ../datasets/GlobalWheat2020/images/rres_1 + - ../datasets/GlobalWheat2020/images/inrae_1 + - ../datasets/GlobalWheat2020/images/usask_1 + +val: # 748 images (WARNING: train set contains ethz_1) + - ../datasets/GlobalWheat2020/images/ethz_1 + +test: # 1276 + - ../datasets/GlobalWheat2020/images/utokyo_1 + - ../datasets/GlobalWheat2020/images/utokyo_2 + - ../datasets/GlobalWheat2020/images/nau_1 + - ../datasets/GlobalWheat2020/images/uq_1 + +# number of classes +nc: 1 + +# class names +names: [ 'wheat_head' ] + + +# download command/URL (optional) -------------------------------------------------------------------------------------- +download: | + from utils.general import download, Path + + # Download + dir = Path('../datasets/GlobalWheat2020') # dataset directory + urls = ['https://zenodo.org/record/4298502/files/global-wheat-codalab-official.zip', + 'https://github.com/ultralytics/yolov5/releases/download/v1.0/GlobalWheat2020_labels.zip'] + download(urls, dir=dir) + + # Make Directories + for p in 'annotations', 'images', 'labels': + (dir / p).mkdir(parents=True, exist_ok=True) + + # Move + for p in 'arvalis_1', 'arvalis_2', 'arvalis_3', 'ethz_1', 'rres_1', 'inrae_1', 'usask_1', \ + 'utokyo_1', 'utokyo_2', 'nau_1', 'uq_1': + (dir / p).rename(dir / 'images' / p) # move to /images + f = (dir / p).with_suffix('.json') # json file + if f.exists(): + f.rename((dir / 'annotations' / p).with_suffix('.json')) # move to /annotations diff --git a/data/visdrone.yaml b/data/VisDrone.yaml similarity index 95% rename from data/visdrone.yaml rename to data/VisDrone.yaml index c23e6bc286f8..c4603b200132 100644 --- a/data/visdrone.yaml +++ b/data/VisDrone.yaml @@ -1,5 +1,5 @@ # VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset -# Train command: python train.py --data visdrone.yaml +# Train command: python train.py --data VisDrone.yaml # Default dataset location is next to YOLOv5: # /parent_folder # /VisDrone @@ -20,11 +20,7 @@ names: [ 'pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', ' # download command/URL (optional) -------------------------------------------------------------------------------------- download: | - import os - from pathlib import Path - - from utils.general import download - + from utils.general import download, os, Path def visdrone2yolo(dir): from PIL import Image