GlobalWheat2020.yaml 2.0 KB

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