You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8KB

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