Skip to content

Commit 9b4d3f2

Browse files
authored
Merge pull request #95 from DeepLabCut/mwm/fixModelDownload
Update check_install.py
2 parents ee04782 + 37c3701 commit 9b4d3f2

File tree

5 files changed

+1020
-739
lines changed

5 files changed

+1020
-739
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ authors:
5252
date-released: 2020-08-05
5353
doi: "10.7554/eLife.61909"
5454
license: "AGPL-3.0-or-later"
55-
version: "1.0.2"
55+
version: "1.0.3"

dlclive/check_install/check_install.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88

9-
import os
109
import sys
1110
import shutil
1211
import warnings
@@ -15,7 +14,9 @@
1514
import urllib.request
1615
import argparse
1716
from pathlib import Path
18-
import tarfile
17+
from dlclibrary.dlcmodelzoo.modelzoo_download import (
18+
download_huggingface_model,
19+
)
1920

2021

2122
def urllib_pbar(count, blockSize, totalSize):
@@ -25,6 +26,7 @@ def urllib_pbar(count, blockSize, totalSize):
2526
sys.stdout.write("\b"*len(outstr))
2627
sys.stdout.flush()
2728

29+
2830
def main(display:bool=None):
2931
parser = argparse.ArgumentParser(
3032
description="Test DLC-Live installation by downloading and evaluating a demo DLC project!")
@@ -43,31 +45,23 @@ def main(display:bool=None):
4345
tmp_dir.mkdir(mode=0o775,exist_ok=True)
4446

4547
video_file = str(tmp_dir / 'dog_clip.avi')
46-
model_tarball = tmp_dir / 'DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz'
47-
model_dir = model_tarball.with_suffix('').with_suffix('') # remove two suffixes (tar.gz)
48-
48+
model_dir = tmp_dir / 'DLC_Dog_resnet_50_iteration-0_shuffle-0'
4949

5050
# download dog test video from github:
5151
print(f"Downloading Video to {video_file}")
5252
url_link = "https://github.com/DeepLabCut/DeepLabCut-live/blob/master/check_install/dog_clip.avi?raw=True"
5353
urllib.request.urlretrieve(url_link, video_file, reporthook=urllib_pbar)
5454

5555
# download exported dog model from DeepLabCut Model Zoo
56-
if Path(model_tarball).exists():
57-
print('Tarball already downloaded, using cached version')
56+
if Path(model_dir / 'snapshot-75000.pb').exists():
57+
print('Model already downloaded, using cached version')
5858
else:
5959
print("Downloading full_dog model from the DeepLabCut Model Zoo...")
60-
model_url = "http://deeplabcut.rowland.harvard.edu/models/DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz"
61-
urllib.request.urlretrieve(model_url, str(model_tarball), reporthook=urllib_pbar)
62-
63-
print('Untarring compressed model')
64-
model_file = tarfile.open(str(model_tarball))
65-
model_file.extractall(str(model_dir.parent))
66-
model_file.close()
60+
download_huggingface_model("full_dog", model_dir)
6761

6862
# assert these things exist so we can give informative error messages
6963
assert Path(video_file).exists()
70-
assert Path(model_dir).exists() and Path(model_dir).is_dir()
64+
assert Path(model_dir / 'snapshot-75000.pb').exists()
7165

7266
# run benchmark videos
7367
print("\n Running inference...\n")

dlclive/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"""
88

99

10-
__version__ = "1.0.2"
10+
__version__ = "1.0.3"
1111
VERSION = __version__

0 commit comments

Comments
 (0)