No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

get_argoverse_hd.sh 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # Argoverse-HD dataset (ring-front-center camera) http://www.cs.cmu.edu/~mengtial/proj/streaming/
  3. # Download command: bash data/scripts/get_argoverse_hd.sh
  4. # Train command: python train.py --data argoverse_hd.yaml
  5. # Default dataset location is next to YOLOv5:
  6. # /parent_folder
  7. # /argoverse
  8. # /yolov5
  9. # Download/unzip images
  10. d='../argoverse/' # unzip directory
  11. mkdir $d
  12. url=https://argoverse-hd.s3.us-east-2.amazonaws.com/
  13. f=Argoverse-HD-Full.zip
  14. curl -L $url$f -o $f && unzip -q $f -d $d && rm $f &# download, unzip, remove in background
  15. wait # finish background tasks
  16. cd ../argoverse/Argoverse-1.1/
  17. ln -s tracking images
  18. cd ../Argoverse-HD/annotations/
  19. python3 - "$@" <<END
  20. import json
  21. from pathlib import Path
  22. annotation_files = ["train.json", "val.json"]
  23. print("Converting annotations to YOLOv5 format...")
  24. for val in annotation_files:
  25. a = json.load(open(val, "rb"))
  26. label_dict = {}
  27. for annot in a['annotations']:
  28. img_id = annot['image_id']
  29. img_name = a['images'][img_id]['name']
  30. img_label_name = img_name[:-3] + "txt"
  31. cls = annot['category_id'] # instance class id
  32. x_center, y_center, width, height = annot['bbox']
  33. x_center = (x_center + width / 2) / 1920. # offset and scale
  34. y_center = (y_center + height / 2) / 1200. # offset and scale
  35. width /= 1920. # scale
  36. height /= 1200. # scale
  37. img_dir = "./labels/" + a['seq_dirs'][a['images'][annot['image_id']]['sid']]
  38. Path(img_dir).mkdir(parents=True, exist_ok=True)
  39. if img_dir + "/" + img_label_name not in label_dict:
  40. label_dict[img_dir + "/" + img_label_name] = []
  41. label_dict[img_dir + "/" + img_label_name].append(f"{cls} {x_center} {y_center} {width} {height}\n")
  42. for filename in label_dict:
  43. with open(filename, "w") as file:
  44. for string in label_dict[filename]:
  45. file.write(string)
  46. END
  47. mv ./labels ../../Argoverse-1.1/