GlobalWheat2020.yaml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # YOLOv5 🚀 by Ultralytics, GPL-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. # 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, ..]
  9. path: ../datasets/GlobalWheat2020 # dataset root dir
  10. train: # train images (relative to 'path') 3422 images
  11. - images/arvalis_1
  12. - images/arvalis_2
  13. - images/arvalis_3
  14. - images/ethz_1
  15. - images/rres_1
  16. - images/inrae_1
  17. - images/usask_1
  18. val: # val images (relative to 'path') 748 images (WARNING: train set contains ethz_1)
  19. - images/ethz_1
  20. test: # test images (optional) 1276 images
  21. - images/utokyo_1
  22. - images/utokyo_2
  23. - images/nau_1
  24. - images/uq_1
  25. # Classes
  26. nc: 1 # number of classes
  27. names: ['wheat_head'] # class names
  28. # Download script/URL (optional) ---------------------------------------------------------------------------------------
  29. download: |
  30. from utils.general import download, Path
  31. # Download
  32. dir = Path(yaml['path']) # dataset root dir
  33. urls = ['https://zenodo.org/record/4298502/files/global-wheat-codalab-official.zip',
  34. 'https://github.com/ultralytics/yolov5/releases/download/v1.0/GlobalWheat2020_labels.zip']
  35. download(urls, dir=dir)
  36. # Make Directories
  37. for p in 'annotations', 'images', 'labels':
  38. (dir / p).mkdir(parents=True, exist_ok=True)
  39. # Move
  40. for p in 'arvalis_1', 'arvalis_2', 'arvalis_3', 'ethz_1', 'rres_1', 'inrae_1', 'usask_1', \
  41. 'utokyo_1', 'utokyo_2', 'nau_1', 'uq_1':
  42. (dir / p).rename(dir / 'images' / p) # move to /images
  43. f = (dir / p).with_suffix('.json') # json file
  44. if f.exists():
  45. f.rename((dir / 'annotations' / p).with_suffix('.json')) # move to /annotations