-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
64 lines (58 loc) · 2.58 KB
/
setup.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
57
58
59
60
61
62
63
64
import os
import urllib
import zipfile
ACTIONS = [
"boxing",
"handclapping",
"handwaving",
"jogging",
"running",
"walking"
]
def download_dataset():
print "Getting zip videos..."
urllib.urlretrieve("http://www.nada.kth.se/cvap/actions/walking.zip", "zip_videos/walking.zip")
print "Done downloading 1 of 6"
urllib.urlretrieve("http://www.nada.kth.se/cvap/actions/boxing.zip", "zip_videos/boxing.zip")
print "Done downloading 2 of 6"
urllib.urlretrieve("http://www.nada.kth.se/cvap/actions/handclapping.zip", "zip_videos/handclapping.zip")
print "Done downloading 3 of 6"
urllib.urlretrieve("http://www.nada.kth.se/cvap/actions/handwaving.zip", "zip_videos/handwaving.zip")
print "Done downloading 4 of 6"
urllib.urlretrieve("http://www.nada.kth.se/cvap/actions/jogging.zip", "zip_videos/jogging.zip")
print "Done downloading 5 of 6"
urllib.urlretrieve("http://www.nada.kth.se/cvap/actions/running.zip", "zip_videos/running.zip")
print "Done downloading, now unzipping..."
for a in ACTIONS:
zip_ref = zipfile.ZipFile("zip_videos/" + a + ".zip", 'r')
zip_ref.extractall("input_videos/" + a + "/")
zip_ref.close()
def download_experiment():
print "Getting experiment videos..."
urllib.urlretrieve("https://www.rangeandroam.com/videos/Test1.mp4", "experiment_videos/Test1.mp4")
urllib.urlretrieve("https://www.rangeandroam.com/videos/Test2.mp4", "experiment_videos/Test2.mp4")
urllib.urlretrieve("https://www.rangeandroam.com/videos/Test3.mp4", "experiment_videos/Test3.mp4")
urllib.urlretrieve("https://www.rangeandroam.com/videos/Test4.mp4", "experiment_videos/Test4.mp4")
urllib.urlretrieve("https://www.rangeandroam.com/videos/Test5.mp4", "experiment_videos/Test5.mp4")
print "Done getting experiment videos"
def download_pkl():
print "Getting classifier pkl..."
urllib.urlretrieve("https://www.rangeandroam.com/videos/knn_classifier.pkl", "models/knn_classifier.pkl")
print "Done getting classifier pkl"
def run():
print "Running setup..."
dirs = ["output", "output_videos", "models", "input_videos", "zip_videos", "experiment_videos"]
for directory in dirs:
if not os.path.exists(directory):
os.makedirs(directory)
download_dataset()
download_experiment()
download_pkl()
os.remove("input_videos/boxing/person01_boxing_d4_uncomp.avi")
print "Done with setup!"
print "======================"
print "To run the experiment"
print "$ python experiment.py"
print "======================"
if __name__ == "__main__":
run()