Commit
•
c51dfec
1
Parent(s):
e8a2b83
CVPR 2021 Argoverse-HD dataset autodownload support (#2400)
Browse files* added argoverse-download ability
* bugfix
* add support for Argoverse dataset
* Refactored code
* renamed to argoverse-HD
* unzip -q and YOLOv5
small cleanup items
* add image counts
Co-authored-by: Kartikeya Sharma <[email protected]>
Co-authored-by: Kartikeya Sharma <[email protected]>
Co-authored-by: Glenn Jocher <[email protected]>
- data/argoverse_hd.yaml +21 -0
- data/scripts/get_argoverse_hd.sh +65 -0
data/argoverse_hd.yaml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Argoverse-HD dataset (ring-front-center camera) http://www.cs.cmu.edu/~mengtial/proj/streaming/
|
2 |
+
# Train command: python train.py --data argoverse_hd.yaml
|
3 |
+
# Default dataset location is next to /yolov5:
|
4 |
+
# /parent_folder
|
5 |
+
# /argoverse
|
6 |
+
# /yolov5
|
7 |
+
|
8 |
+
|
9 |
+
# download command/URL (optional)
|
10 |
+
download: bash data/scripts/get_argoverse_hd.sh
|
11 |
+
|
12 |
+
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
|
13 |
+
train: ../argoverse/Argoverse-1.1/images/train/ # 39384 images
|
14 |
+
val: ../argoverse/Argoverse-1.1/images/val/ # 15062 iamges
|
15 |
+
test: ../argoverse/Argoverse-1.1/images/test/ # Submit to: https://eval.ai/web/challenges/challenge-page/800/overview
|
16 |
+
|
17 |
+
# number of classes
|
18 |
+
nc: 8
|
19 |
+
|
20 |
+
# class names
|
21 |
+
names: [ 'person', 'bicycle', 'car', 'motorcycle', 'bus', 'truck', 'traffic_light', 'stop_sign' ]
|
data/scripts/get_argoverse_hd.sh
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
10 |
+
# Download/unzip images
|
11 |
+
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
|
20 |
+
|
21 |
+
cd ../Argoverse-HD/annotations/
|
22 |
+
|
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 |
+
|
29 |
+
for val in annotation_files:
|
30 |
+
a = json.load(open(val, "rb"))
|
31 |
+
|
32 |
+
label_dict = {}
|
33 |
+
for annot in a['annotations']:
|
34 |
+
img_id = annot['image_id']
|
35 |
+
img_name = a['images'][img_id]['name']
|
36 |
+
img_label_name = img_name[:-3] + "txt"
|
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 |
+
|
47 |
+
Path(img_dir).mkdir(parents=True, exist_ok=True)
|
48 |
+
|
49 |
+
if img_dir + "/" + img_label_name not in label_dict:
|
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]:
|
57 |
+
file.write(string)
|
58 |
+
|
59 |
+
END
|
60 |
+
|
61 |
+
mv ./labels ../../Argoverse-1.1/
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|