-
Notifications
You must be signed in to change notification settings - Fork 49
/
check_install.py
executable file
·48 lines (35 loc) · 1.39 KB
/
check_install.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
"""
DeepLabCut Toolbox (deeplabcut.org)
© A. & M. Mathis Labs
Licensed under GNU Lesser General Public License v3.0
"""
import os
import shutil
from dlclive import benchmark_videos
import urllib.request
def main():
# make temporary directory in $HOME
print("\nCreating temporary directory...\n")
home = os.path.expanduser("~")
tmp_dir = os.path.normpath(f"{home}/dlc-live-tmp")
os.makedirs(tmp_dir, exist_ok=True)
os.chdir(tmp_dir)
# download dog test video from github:
url_link = "https://github.com/DeepLabCut/DeepLabCut-live/blob/master/check_install/dog_clip.avi?raw=True"
urllib.request.urlretrieve(url_link, "dog_clip.avi")
video_file = os.path.join(url_link, "dog_clip.avi")
# download exported dog model from DeepLabCut Model Zoo
print("Downloading full_dog model from the DeepLabCut Model Zoo...")
model_url = "http://deeplabcut.rowland.harvard.edu/models/DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz"
os.system(f"curl {model_url} | tar xvz")
# run benchmark videos
print("\n Running inference...\n")
model_dir = "DLC_Dog_resnet_50_iteration-0_shuffle-0"
print(video_file)
benchmark_videos(model_dir, video_file, display=True, resize=0.5, pcutoff=0.25)
# deleting temporary files
print("\n Deleting temporary files...\n")
shutil.rmtree(tmp_dir)
print("\nDone!\n")
if __name__ == "__main__":
main()