MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / parse_project_model_name

Function parse_project_model_name

deeplabcut/modelzoo/utils.py:187–231  ·  view source on GitHub ↗

Parses model zoo model names for SuperAnimal models. Args: superanimal_name: the name of the SuperAnimal model name to parse Returns: project_name: the parsed SuperAnimal model name model_name: the model architecture (e.g., dlcrnet, hrnetw32)

(superanimal_name: str)

Source from the content-addressed store, hash-verified

185
186
187def parse_project_model_name(superanimal_name: str) -> tuple[str, str]:
188 """Parses model zoo model names for SuperAnimal models.
189
190 Args:
191 superanimal_name: the name of the SuperAnimal model name to parse
192
193 Returns:
194 project_name: the parsed SuperAnimal model name
195 model_name: the model architecture (e.g., dlcrnet, hrnetw32)
196 """
197
198 if superanimal_name == "superanimal_quadruped":
199 warnings.warn(
200 f"{superanimal_name} is deprecated and will be removed in a future version. Use"
201 f"{superanimal_name}_model_suffix instead.",
202 DeprecationWarning,
203 stacklevel=2,
204 )
205 superanimal_name = "superanimal_quadruped_hrnetw32"
206
207 if superanimal_name == "superanimal_topviewmouse":
208 warnings.warn(
209 f"{superanimal_name} is deprecated and will be removed in a future version. Use"
210 f"{superanimal_name}_model_suffix instead.",
211 DeprecationWarning,
212 stacklevel=2,
213 )
214 superanimal_name = "superanimal_topviewmouse_dlcrnet"
215
216 model_name = superanimal_name.split("_")[-1]
217 project_name = superanimal_name.replace(f"_{model_name}", "")
218
219 dlc_root_path = get_deeplabcut_path()
220 modelzoo_path = os.path.join(dlc_root_path, "modelzoo")
221
222 available_model_configs = glob(os.path.join(modelzoo_path, "model_configs", "*.yaml"))
223 available_models = [os.path.splitext(os.path.basename(path))[0] for path in available_model_configs]
224
225 if model_name not in available_models:
226 raise ValueError(f"Model {model_name} not found. Available models are: {available_models}")
227
228 available_project_configs = glob(os.path.join(modelzoo_path, "project_configs", "*.yaml"))
229 [os.path.splitext(os.path.basename(path))[0] for path in available_project_configs]
230
231 return project_name, model_name
232
233
234def get_superanimal_colormaps():

Callers

nothing calls this directly

Calls 2

get_deeplabcut_pathFunction · 0.90
splitMethod · 0.45

Tested by

no test coverage detected