-
Notifications
You must be signed in to change notification settings - Fork 1
/
fetch_data.py
56 lines (39 loc) · 1.05 KB
/
fetch_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import zipfile
import urllib.request
import multiprocessing
files = [
"data_object_calib.zip",
"data_object_label_2.zip",
"data_object_image_2.zip",
# "data_object_velodyne.zip",
]
# files = [
# "data_tracking_velodyne.zip",
# "data_tracking_image_2.zip",
# "data_tracking_oxts.zip",
# "data_tracking_calib.zip",
# "data_tracking_label_2.zip",
# ]
# files = [
# "data_odometry_velodyne.zip",
# ]
location = "https://s3.eu-central-1.amazonaws.com/avg-kitti/"
dst_dir = "kitti/"
os.makedirs(dst_dir, exist_ok=True)
def download(file):
url = location + file
dst_file = os.path.join(dst_dir, file)
if not os.path.exists(dst_file):
print("Downloading", url)
urllib.request.urlretrieve(url, dst_file)
print("Unzipping", url)
with zipfile.ZipFile(dst_file, 'r') as zip_ref:
zip_ref.extractall(dst_dir)
print("Done", url)
def main():
pool = multiprocessing.Pool(len(files))
pool.map(download, files)
print("Done!")
if __name__ == "__main__":
main()