forked from maurapintor/pandavision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_demo_data.py
31 lines (27 loc) · 1.06 KB
/
prepare_demo_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
import os
import urllib
from urllib.request import urlopen
from config import config
def prepare_images():
"""Downloads a subset of the Imagenet Dataset."""
img_folder = os.path.join(config.DATA_DIR, "imagenet_subset")
if not os.path.exists(img_folder):
os.makedirs(img_folder)
fname = os.path.join(img_folder, "data.h5")
if not os.path.exists(fname):
data_url = 'https://github.com/maurapintor/pandavision/' \
'releases/download/v0.1/data.h5'
urllib.request.urlretrieve(data_url, fname)
def prepare_model():
"""Downloads an ONNX pretrained model."""
model_folder = os.path.join(config.DATA_DIR, "models")
if not os.path.exists(model_folder):
os.makedirs(model_folder)
fname = os.path.join(model_folder, "model.onnx")
if not os.path.exists(fname):
data_url = 'https://github.com/maurapintor/pandavision/' \
'releases/download/v0.1/model.onnx'
urllib.request.urlretrieve(data_url, fname)
if __name__ == '__main__':
prepare_images()
prepare_model()