Skip to content

Commit 86be0d7

Browse files
authored
Merge pull request #100 from n-poulsen/fix_check_install_script
Fixed the check install script to use the new models
2 parents 9b4d3f2 + 8c6e843 commit 86be0d7

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

dlclive/check_install/check_install.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
)
2020

2121

22+
MODEL_NAME = "superanimal_quadruped"
23+
SNAPSHOT_NAME = "snapshot-700000.pb"
24+
25+
2226
def urllib_pbar(count, blockSize, totalSize):
2327
percent = int(count * blockSize * 100 / totalSize)
2428
outstr = f"{round(percent)}%"
@@ -27,19 +31,18 @@ def urllib_pbar(count, blockSize, totalSize):
2731
sys.stdout.flush()
2832

2933

30-
def main(display:bool=None):
34+
def main():
3135
parser = argparse.ArgumentParser(
3236
description="Test DLC-Live installation by downloading and evaluating a demo DLC project!")
3337
parser.add_argument('--nodisplay', action='store_false', help="Run the test without displaying tracking")
3438
args = parser.parse_args()
35-
36-
if display is None:
37-
display = args.nodisplay
39+
display = args.nodisplay
3840

3941
if not display:
4042
print('Running without displaying video')
4143

4244
# make temporary directory in $HOME
45+
# TODO: why create this temp directory in $HOME?
4346
print("\nCreating temporary directory...\n")
4447
tmp_dir = Path().home() / 'dlc-live-tmp'
4548
tmp_dir.mkdir(mode=0o775,exist_ok=True)
@@ -48,25 +51,24 @@ def main(display:bool=None):
4851
model_dir = tmp_dir / 'DLC_Dog_resnet_50_iteration-0_shuffle-0'
4952

5053
# 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)
5155
print(f"Downloading Video to {video_file}")
5256
url_link = "https://github.com/DeepLabCut/DeepLabCut-live/blob/master/check_install/dog_clip.avi?raw=True"
5357
urllib.request.urlretrieve(url_link, video_file, reporthook=urllib_pbar)
5458

55-
# download exported dog model from DeepLabCut Model Zoo
56-
if Path(model_dir / 'snapshot-75000.pb').exists():
59+
# download model from the DeepLabCut Model Zoo
60+
if Path(model_dir / SNAPSHOT_NAME).exists():
5761
print('Model already downloaded, using cached version')
5862
else:
5963
print("Downloading full_dog model from the DeepLabCut Model Zoo...")
60-
download_huggingface_model("full_dog", model_dir)
64+
download_huggingface_model(MODEL_NAME, model_dir)
6165

6266
# assert these things exist so we can give informative error messages
63-
assert Path(video_file).exists()
64-
assert Path(model_dir / 'snapshot-75000.pb').exists()
67+
assert Path(video_file).exists(), f"Missing video file {video_file}"
68+
assert Path(model_dir / SNAPSHOT_NAME).exists(), f"Missing model file {model_dir / SNAPSHOT_NAME}"
6569

6670
# run benchmark videos
6771
print("\n Running inference...\n")
68-
# model_dir = "DLC_Dog_resnet_50_iteration-0_shuffle-0"
69-
# print(video_file)
7072
benchmark_videos(str(model_dir), video_file, display=display, resize=0.5, pcutoff=0.25)
7173

7274
# deleting temporary files
@@ -80,9 +82,4 @@ def main(display:bool=None):
8082

8183

8284
if __name__ == "__main__":
83-
84-
85-
display = args.nodisplay
86-
87-
88-
main(display=args.nodisplay)
85+
main()

0 commit comments

Comments
 (0)