|
5 | 5 | Licensed under GNU Lesser General Public License v3.0
|
6 | 6 | """
|
7 | 7 |
|
8 |
| - |
| 8 | +import os |
| 9 | +import urllib.request |
9 | 10 | import sys
|
10 | 11 | import shutil
|
11 | 12 | import warnings
|
@@ -41,26 +42,27 @@ def main():
|
41 | 42 | if not display:
|
42 | 43 | print('Running without displaying video')
|
43 | 44 |
|
44 |
| - # make temporary directory in $HOME |
45 |
| - # TODO: why create this temp directory in $HOME? |
| 45 | + # make temporary directory in $current |
46 | 46 | print("\nCreating temporary directory...\n")
|
47 |
| - tmp_dir = Path().home() / 'dlc-live-tmp' |
48 |
| - tmp_dir.mkdir(mode=0o775,exist_ok=True) |
| 47 | + tmp_dir = Path.cwd() / 'dlc-live-tmp' |
| 48 | + tmp_dir.mkdir(mode=0o775, exist_ok=True) |
49 | 49 |
|
50 | 50 | video_file = str(tmp_dir / 'dog_clip.avi')
|
51 | 51 | model_dir = tmp_dir / 'DLC_Dog_resnet_50_iteration-0_shuffle-0'
|
52 | 52 |
|
53 | 53 | # download dog test video from github:
|
54 |
| - # TODO: Should check if the video's already there before downloading it (should have been cloned with the files) |
55 |
| - print(f"Downloading Video to {video_file}") |
56 |
| - url_link = "https://github.com/DeepLabCut/DeepLabCut-live/blob/master/check_install/dog_clip.avi?raw=True" |
57 |
| - urllib.request.urlretrieve(url_link, video_file, reporthook=urllib_pbar) |
| 54 | + if not os.path.exists(video_file): |
| 55 | + print(f"Downloading Video to {video_file}") |
| 56 | + url_link = "https://github.com/DeepLabCut/DeepLabCut-live/blob/main/check_install/dog_clip.avi?raw=True" |
| 57 | + urllib.request.urlretrieve(url_link, video_file, reporthook=urllib_pbar) |
| 58 | + else: |
| 59 | + print(f"Video already exists at {video_file}") |
58 | 60 |
|
59 | 61 | # download model from the DeepLabCut Model Zoo
|
60 | 62 | if Path(model_dir / SNAPSHOT_NAME).exists():
|
61 | 63 | print('Model already downloaded, using cached version')
|
62 | 64 | else:
|
63 |
| - print("Downloading full_dog model from the DeepLabCut Model Zoo...") |
| 65 | + print("Downloading a test model from the DeepLabCut Model Zoo...") |
64 | 66 | download_huggingface_model(MODEL_NAME, model_dir)
|
65 | 67 |
|
66 | 68 | # assert these things exist so we can give informative error messages
|
|
0 commit comments