Delete DLC_models
Browse filesFiles changed (4)
- DLC_models/download_utils.pyDeleted-61
- DLC_models/models.pyDeleted-60
- DLC_models/pretrained_model_urls.yamlDeleted-19
- DLC_models/read.mdDeleted-3
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061import urllib.requestimport tarfilefrom tqdm import tqdmimport osimport yamlfrom ruamel.yaml import YAML
def read_plainconfig(configname): if not os.path.exists(configname): raise FileNotFoundError( f"Config {configname} is not found. Please make sure that the file exists." ) with open(configname) as file: return YAML().load(file)
def DownloadModel(modelname, target_dir): """ Downloads a DeepLabCut Model Zoo Project """ def show_progress(count, block_size, total_size): pbar.update(block_size)
def tarfilenamecutting(tarf): """' auxfun to extract folder path ie. /xyz-trainsetxyshufflez/ """ for memberid, member in enumerate(tarf.getmembers()): if memberid == 0: parent = str(member.path) l = len(parent) + 1 if member.path.startswith(parent): member.path = member.path[l:] yield member
neturls = read_plainconfig("DLC_models/pretrained_model_urls.yaml") #FIXME if modelname in neturls.keys(): url = neturls[modelname] print(url) response = urllib.request.urlopen(url) print( "Downloading the model from the DeepLabCut server @Harvard -> Go Crimson!!! {}....".format( url ) ) total_size = int(response.getheader("Content-Length")) pbar = tqdm(unit="B", total=total_size, position=0) filename, _ = urllib.request.urlretrieve(url, reporthook=show_progress) with tarfile.open(filename, mode="r:gz") as tar: tar.extractall(target_dir, members=tarfilenamecutting(tar)) else: models = [ fn for fn in neturls.keys() if "resnet_" not in fn and "mobilenet_" not in fn ] print("Model does not exist: ", modelname) print("Pick one of the following: ", models) return target_dir123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import urllib.requestimport tarfilefrom tqdm import tqdmimport osimport yamlfrom ruamel.yaml import YAML
def read_plainconfig(configname): if not os.path.exists(configname): raise FileNotFoundError( f"Config {configname} is not found. Please make sure that the file exists." ) with open(configname) as file: return YAML().load(file)
def DownloadModel(modelname, target_dir): """ Downloads a DeepLabCut Model Zoo Project """ def show_progress(count, block_size, total_size): pbar.update(block_size)
def tarfilenamecutting(tarf): """' auxfun to extract folder path ie. /xyz-trainsetxyshufflez/ """ for memberid, member in enumerate(tarf.getmembers()): if memberid == 0: parent = str(member.path) l = len(parent) + 1 if member.path.startswith(parent): member.path = member.path[l:] yield member
neturls = read_plainconfig("./model/pretrained_model_urls.yaml") #FIXME if modelname in neturls.keys(): url = neturls[modelname] print(url) response = urllib.request.urlopen(url) print( "Downloading the model from the DeepLabCut server @Harvard -> Go Crimson!!! {}....".format( url ) ) total_size = int(response.getheader("Content-Length")) pbar = tqdm(unit="B", total=total_size, position=0) filename, _ = urllib.request.urlretrieve(url, reporthook=show_progress) with tarfile.open(filename, mode="r:gz") as tar: tar.extractall(target_dir, members=tarfilenamecutting(tar)) else: models = [ fn for fn in neturls.keys() if "resnet_" not in fn and "mobilenet_" not in fn ] print("Model does not exist: ", modelname) print("Pick one of the following: ", models) return target_dir12345678910111213141516171819#Model Zoo from where the Charles flow(s)full_human: https://huggingface.co/mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/resolve/main/DLC_human_fullbody_resnet_101.tar.gz#full_dog: https://huggingface.co/mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/resolve/main/DLC_human_fullbody_resnet_101.tar.gz#full_cat: https://huggingface.co/mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/resolve/main/DLC_human_fullbody_resnet_101.tar.gzprimate_face: https://huggingface.co/mwmathis/DeepLabCutModelZoo-primate_face/resolve/main/DLC_primate_face_resnet_50_iteration-1_shuffle-1.tar.gzmouse_pupil_vclose: https://huggingface.co/mwmathis/DeepLabCutModelZoo-mouse_pupil_vclose/resolve/main/DLC_mouse_pupil_vclose_resnet_50_iteration-0_shuffle-1.tar.gzhorse_sideview: https://huggingface.co/mwmathis/DeepLabCutModelZoo-horse_sideview/resolve/main/DLC_Horses_resnet_50_iteration-1_shuffle-1.tar.gzfull_macaque: https://huggingface.co/mwmathis/DeepLabCutModelZoo-macaque_full/resolve/main/DLC_macaque_full_resnet50.tar.gz#full_cheetah: https://huggingface.co/mwmathis/DeepLabCutModelZoo-macaque_full/resolve/main/DLC_macaque_full_resnet50.tar.gz
#Old URLs for the models#full_human: http://deeplabcut.rowland.harvard.edu/models/DLC_human_fullbody_resnet_101.tar.gz#full_dog: http://deeplabcut.rowland.harvard.edu/models/DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz#full_cat: http://deeplabcut.rowland.harvard.edu/models/DLC_Cat_resnet_50_iteration-0_shuffle-0.tar.gz#primate_face: http://deeplabcut.rowland.harvard.edu/models/DLC_primate_face_resnet_50_iteration-1_shuffle-1.tar.gz#mouse_pupil_vclose: http://deeplabcut.rowland.harvard.edu/models/DLC_mouse_pupil_vclose_resnet_50_iteration-0_shuffle-1.tar.gz#horse_sideview: http://deeplabcut.rowland.harvard.edu/models/DLC_Horses_resnet_50_iteration-1_shuffle-1.tar.gz#full_macaque: http://deeplabcut.rowland.harvard.edu/models/DLC_macaque_full_resnet50.tar.gz#full_cheetah: http://deeplabcut.rowland.harvard.edu/models/DLC_full_cheetah_resnet_152.tar.123These models are part of the DeepLabCut Model zoo. For details, model citations, and further information, please see: modelzoo.deeplabcut.org
https://arxiv.org/abs/2203.07436v1 & http://modelzoo.deeplabcut.org DLC_models/download_utils.pyDeleted-61
DLC_models/models.pyDeleted-60
DLC_models/pretrained_model_urls.yamlDeleted-19
DLC_models/read.mdDeleted-3