Skip to content

Commit

Permalink
CVPR 2021 Argoverse-HD autodownload fix (ultralytics#2418)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Mar 10, 2021
1 parent 71a6e14 commit ed6552d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions data/scripts/get_argoverse_hd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ d='../argoverse/' # unzip directory
mkdir $d
url=https://argoverse-hd.s3.us-east-2.amazonaws.com/
f=Argoverse-HD-Full.zip
wget $url$f -O $f && unzip -q $f -d $d && rm $f & # download, unzip, remove in background
wait # finish background tasks
wget $url$f -O $f && unzip -q $f -d $d && rm $f &# download, unzip, remove in background
wait # finish background tasks

cd ../argoverse/Argoverse-1.1/
ln -s tracking images
Expand All @@ -23,6 +23,7 @@ cd ../Argoverse-HD/annotations/
python3 - "$@" <<END
import json
from pathlib import Path
annotation_files = ["train.json", "val.json"]
print("Converting annotations to YOLOv5 format...")
Expand All @@ -37,10 +38,10 @@ for val in annotation_files:
obj_class = annot['category_id']
x_center, y_center, width, height = annot['bbox']
x_center = x_center / 1920.0
width = width / 1920.0
y_center = y_center / 1200.0
height = height / 1200.0
x_center = (x_center + width / 2) / 1920. # offset and scale
y_center = (y_center + height / 2) / 1200. # offset and scale
width /= 1920. # scale
height /= 1200. # scale
img_dir = "./labels/" + a['seq_dirs'][a['images'][annot['image_id']]['sid']]
Expand All @@ -50,7 +51,7 @@ for val in annotation_files:
label_dict[img_dir + "/" + img_label_name] = []
label_dict[img_dir + "/" + img_label_name].append(f"{obj_class} {x_center} {y_center} {width} {height}\n")
for filename in label_dict:
with open(filename, "w") as file:
for string in label_dict[filename]:
Expand All @@ -59,7 +60,3 @@ for val in annotation_files:
END

mv ./labels ../../Argoverse-1.1/




0 comments on commit ed6552d

Please sign in to comment.