Delete DLC_models
Browse files- DLC_models/download_utils.py +0 -61
- DLC_models/models.py +0 -60
- DLC_models/pretrained_model_urls.yaml +0 -19
- DLC_models/read.md +0 -3
DLC_models/download_utils.py
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
import urllib.request
|
2 |
-
import tarfile
|
3 |
-
from tqdm import tqdm
|
4 |
-
import os
|
5 |
-
import yaml
|
6 |
-
from ruamel.yaml import YAML
|
7 |
-
|
8 |
-
def read_plainconfig(configname):
|
9 |
-
if not os.path.exists(configname):
|
10 |
-
raise FileNotFoundError(
|
11 |
-
f"Config {configname} is not found. Please make sure that the file exists."
|
12 |
-
)
|
13 |
-
with open(configname) as file:
|
14 |
-
return YAML().load(file)
|
15 |
-
|
16 |
-
def DownloadModel(modelname,
|
17 |
-
target_dir):
|
18 |
-
"""
|
19 |
-
Downloads a DeepLabCut Model Zoo Project
|
20 |
-
"""
|
21 |
-
|
22 |
-
def show_progress(count, block_size, total_size):
|
23 |
-
pbar.update(block_size)
|
24 |
-
|
25 |
-
def tarfilenamecutting(tarf):
|
26 |
-
"""' auxfun to extract folder path
|
27 |
-
ie. /xyz-trainsetxyshufflez/
|
28 |
-
"""
|
29 |
-
for memberid, member in enumerate(tarf.getmembers()):
|
30 |
-
if memberid == 0:
|
31 |
-
parent = str(member.path)
|
32 |
-
l = len(parent) + 1
|
33 |
-
if member.path.startswith(parent):
|
34 |
-
member.path = member.path[l:]
|
35 |
-
yield member
|
36 |
-
|
37 |
-
neturls = read_plainconfig("DLC_models/pretrained_model_urls.yaml") #FIXME
|
38 |
-
|
39 |
-
if modelname in neturls.keys():
|
40 |
-
url = neturls[modelname]
|
41 |
-
print(url)
|
42 |
-
response = urllib.request.urlopen(url)
|
43 |
-
print(
|
44 |
-
"Downloading the model from the DeepLabCut server @Harvard -> Go Crimson!!! {}....".format(
|
45 |
-
url
|
46 |
-
)
|
47 |
-
)
|
48 |
-
total_size = int(response.getheader("Content-Length"))
|
49 |
-
pbar = tqdm(unit="B", total=total_size, position=0)
|
50 |
-
filename, _ = urllib.request.urlretrieve(url, reporthook=show_progress)
|
51 |
-
with tarfile.open(filename, mode="r:gz") as tar:
|
52 |
-
tar.extractall(target_dir, members=tarfilenamecutting(tar))
|
53 |
-
else:
|
54 |
-
models = [
|
55 |
-
fn
|
56 |
-
for fn in neturls.keys()
|
57 |
-
if "resnet_" not in fn and "mobilenet_" not in fn
|
58 |
-
]
|
59 |
-
print("Model does not exist: ", modelname)
|
60 |
-
print("Pick one of the following: ", models)
|
61 |
-
return target_dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DLC_models/models.py
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
import urllib.request
|
2 |
-
import tarfile
|
3 |
-
from tqdm import tqdm
|
4 |
-
import os
|
5 |
-
import yaml
|
6 |
-
from ruamel.yaml import YAML
|
7 |
-
|
8 |
-
def read_plainconfig(configname):
|
9 |
-
if not os.path.exists(configname):
|
10 |
-
raise FileNotFoundError(
|
11 |
-
f"Config {configname} is not found. Please make sure that the file exists."
|
12 |
-
)
|
13 |
-
with open(configname) as file:
|
14 |
-
return YAML().load(file)
|
15 |
-
|
16 |
-
def DownloadModel(modelname, target_dir):
|
17 |
-
"""
|
18 |
-
Downloads a DeepLabCut Model Zoo Project
|
19 |
-
"""
|
20 |
-
|
21 |
-
def show_progress(count, block_size, total_size):
|
22 |
-
pbar.update(block_size)
|
23 |
-
|
24 |
-
def tarfilenamecutting(tarf):
|
25 |
-
"""' auxfun to extract folder path
|
26 |
-
ie. /xyz-trainsetxyshufflez/
|
27 |
-
"""
|
28 |
-
for memberid, member in enumerate(tarf.getmembers()):
|
29 |
-
if memberid == 0:
|
30 |
-
parent = str(member.path)
|
31 |
-
l = len(parent) + 1
|
32 |
-
if member.path.startswith(parent):
|
33 |
-
member.path = member.path[l:]
|
34 |
-
yield member
|
35 |
-
|
36 |
-
neturls = read_plainconfig("./model/pretrained_model_urls.yaml") #FIXME
|
37 |
-
|
38 |
-
if modelname in neturls.keys():
|
39 |
-
url = neturls[modelname]
|
40 |
-
print(url)
|
41 |
-
response = urllib.request.urlopen(url)
|
42 |
-
print(
|
43 |
-
"Downloading the model from the DeepLabCut server @Harvard -> Go Crimson!!! {}....".format(
|
44 |
-
url
|
45 |
-
)
|
46 |
-
)
|
47 |
-
total_size = int(response.getheader("Content-Length"))
|
48 |
-
pbar = tqdm(unit="B", total=total_size, position=0)
|
49 |
-
filename, _ = urllib.request.urlretrieve(url, reporthook=show_progress)
|
50 |
-
with tarfile.open(filename, mode="r:gz") as tar:
|
51 |
-
tar.extractall(target_dir, members=tarfilenamecutting(tar))
|
52 |
-
else:
|
53 |
-
models = [
|
54 |
-
fn
|
55 |
-
for fn in neturls.keys()
|
56 |
-
if "resnet_" not in fn and "mobilenet_" not in fn
|
57 |
-
]
|
58 |
-
print("Model does not exist: ", modelname)
|
59 |
-
print("Pick one of the following: ", models)
|
60 |
-
return target_dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DLC_models/pretrained_model_urls.yaml
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
#Model Zoo from where the Charles flow(s)
|
2 |
-
full_human: https://huggingface.co/mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/resolve/main/DLC_human_fullbody_resnet_101.tar.gz
|
3 |
-
#full_dog: https://huggingface.co/mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/resolve/main/DLC_human_fullbody_resnet_101.tar.gz
|
4 |
-
#full_cat: https://huggingface.co/mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/resolve/main/DLC_human_fullbody_resnet_101.tar.gz
|
5 |
-
primate_face: https://huggingface.co/mwmathis/DeepLabCutModelZoo-primate_face/resolve/main/DLC_primate_face_resnet_50_iteration-1_shuffle-1.tar.gz
|
6 |
-
mouse_pupil_vclose: https://huggingface.co/mwmathis/DeepLabCutModelZoo-mouse_pupil_vclose/resolve/main/DLC_mouse_pupil_vclose_resnet_50_iteration-0_shuffle-1.tar.gz
|
7 |
-
horse_sideview: https://huggingface.co/mwmathis/DeepLabCutModelZoo-horse_sideview/resolve/main/DLC_Horses_resnet_50_iteration-1_shuffle-1.tar.gz
|
8 |
-
full_macaque: https://huggingface.co/mwmathis/DeepLabCutModelZoo-macaque_full/resolve/main/DLC_macaque_full_resnet50.tar.gz
|
9 |
-
#full_cheetah: https://huggingface.co/mwmathis/DeepLabCutModelZoo-macaque_full/resolve/main/DLC_macaque_full_resnet50.tar.gz
|
10 |
-
|
11 |
-
#Old URLs for the models
|
12 |
-
#full_human: http://deeplabcut.rowland.harvard.edu/models/DLC_human_fullbody_resnet_101.tar.gz
|
13 |
-
#full_dog: http://deeplabcut.rowland.harvard.edu/models/DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz
|
14 |
-
#full_cat: http://deeplabcut.rowland.harvard.edu/models/DLC_Cat_resnet_50_iteration-0_shuffle-0.tar.gz
|
15 |
-
#primate_face: http://deeplabcut.rowland.harvard.edu/models/DLC_primate_face_resnet_50_iteration-1_shuffle-1.tar.gz
|
16 |
-
#mouse_pupil_vclose: http://deeplabcut.rowland.harvard.edu/models/DLC_mouse_pupil_vclose_resnet_50_iteration-0_shuffle-1.tar.gz
|
17 |
-
#horse_sideview: http://deeplabcut.rowland.harvard.edu/models/DLC_Horses_resnet_50_iteration-1_shuffle-1.tar.gz
|
18 |
-
#full_macaque: http://deeplabcut.rowland.harvard.edu/models/DLC_macaque_full_resnet50.tar.gz
|
19 |
-
#full_cheetah: http://deeplabcut.rowland.harvard.edu/models/DLC_full_cheetah_resnet_152.tar.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DLC_models/read.md
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
These models are part of the DeepLabCut Model zoo. For details, model citations, and further information, please see: modelzoo.deeplabcut.org
|
2 |
-
|
3 |
-
https://arxiv.org/abs/2203.07436v1 & http://modelzoo.deeplabcut.org
|
|
|
|
|
|
|
|