glenn-jocher commited on
Commit
d5ca8ca
1 Parent(s): c51dfec

CVPR 2021 Argoverse-HD autodownload fix (#2418)

Browse files
Files changed (1) hide show
  1. data/scripts/get_argoverse_hd.sh +8 -11
data/scripts/get_argoverse_hd.sh CHANGED
@@ -12,8 +12,8 @@ d='../argoverse/' # unzip directory
12
  mkdir $d
13
  url=https://argoverse-hd.s3.us-east-2.amazonaws.com/
14
  f=Argoverse-HD-Full.zip
15
- wget $url$f -O $f && unzip -q $f -d $d && rm $f & # download, unzip, remove in background
16
- wait # finish background tasks
17
 
18
  cd ../argoverse/Argoverse-1.1/
19
  ln -s tracking images
@@ -23,6 +23,7 @@ cd ../Argoverse-HD/annotations/
23
  python3 - "$@" <<END
24
  import json
25
  from pathlib import Path
 
26
  annotation_files = ["train.json", "val.json"]
27
  print("Converting annotations to YOLOv5 format...")
28
 
@@ -37,10 +38,10 @@ for val in annotation_files:
37
 
38
  obj_class = annot['category_id']
39
  x_center, y_center, width, height = annot['bbox']
40
- x_center = x_center / 1920.0
41
- width = width / 1920.0
42
- y_center = y_center / 1200.0
43
- height = height / 1200.0
44
 
45
  img_dir = "./labels/" + a['seq_dirs'][a['images'][annot['image_id']]['sid']]
46
 
@@ -50,7 +51,7 @@ for val in annotation_files:
50
  label_dict[img_dir + "/" + img_label_name] = []
51
 
52
  label_dict[img_dir + "/" + img_label_name].append(f"{obj_class} {x_center} {y_center} {width} {height}\n")
53
-
54
  for filename in label_dict:
55
  with open(filename, "w") as file:
56
  for string in label_dict[filename]:
@@ -59,7 +60,3 @@ for val in annotation_files:
59
  END
60
 
61
  mv ./labels ../../Argoverse-1.1/
62
-
63
-
64
-
65
-
 
12
  mkdir $d
13
  url=https://argoverse-hd.s3.us-east-2.amazonaws.com/
14
  f=Argoverse-HD-Full.zip
15
+ wget $url$f -O $f && unzip -q $f -d $d && rm $f &# download, unzip, remove in background
16
+ wait # finish background tasks
17
 
18
  cd ../argoverse/Argoverse-1.1/
19
  ln -s tracking images
 
23
  python3 - "$@" <<END
24
  import json
25
  from pathlib import Path
26
+
27
  annotation_files = ["train.json", "val.json"]
28
  print("Converting annotations to YOLOv5 format...")
29
 
 
38
 
39
  obj_class = annot['category_id']
40
  x_center, y_center, width, height = annot['bbox']
41
+ x_center = (x_center + width / 2) / 1920. # offset and scale
42
+ y_center = (y_center + height / 2) / 1200. # offset and scale
43
+ width /= 1920. # scale
44
+ height /= 1200. # scale
45
 
46
  img_dir = "./labels/" + a['seq_dirs'][a['images'][annot['image_id']]['sid']]
47
 
 
51
  label_dict[img_dir + "/" + img_label_name] = []
52
 
53
  label_dict[img_dir + "/" + img_label_name].append(f"{obj_class} {x_center} {y_center} {width} {height}\n")
54
+
55
  for filename in label_dict:
56
  with open(filename, "w") as file:
57
  for string in label_dict[filename]:
 
60
  END
61
 
62
  mv ./labels ../../Argoverse-1.1/