deeplabcut.modelzoo.utils
Functions:
| Name | Description |
|---|---|
create_conversion_table |
Creates a conversion table mapping bodyparts defined for a DeepLabCut project to |
dlc_modelzoo_path |
Returns: the path to the |
get_conversion_table |
Gets the conversion table from a project to a SuperAnimal model. |
get_super_animal_project_cfg |
Gets the project configuration file for a SuperAnimal model. |
get_super_animal_scorer |
Args: |
parse_project_model_name |
Parses model zoo model names for SuperAnimal models. |
create_conversion_table
create_conversion_table(
config: str | Path, super_animal: str, project_to_super_animal: dict[str, str]
) -> ConversionTable
Creates a conversion table mapping bodyparts defined for a DeepLabCut project to bodyparts defined for a SuperAnimal model. This allows to fine-tune SuperAnimal weights instead of transfer learning from ImageNet. The conversion table is directly added to the project's configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Path
|
The path to the project configuration for which the conversion table should be created. |
required |
|
str
|
The SuperAnimal model for the conversion table |
required |
|
dict[str, str]
|
The conversion table mapping each project bodypart to the corresponding SuperAnimal bodypart. |
required |
Returns:
| Type | Description |
|---|---|
ConversionTable
|
The conversion table that was added to the project config. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the conversion table is misconfigured (e.g., if there are misnamed bodyparts in the table). See ConversionTable for more. |
Source code in deeplabcut/modelzoo/utils.py
dlc_modelzoo_path
Returns: the path to the modelzoo folder in the DeepLabCut installation
get_conversion_table
Gets the conversion table from a project to a SuperAnimal model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict | str | Path
|
The path to a project configuration file, or directly the project config. |
required |
|
str
|
The SuperAnimal for which to get the configuration file. |
required |
Returns:
| Type | Description |
|---|---|
ConversionTable
|
A dictionary mapping {project_bodypart: super_animal_bodypart} |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the conversion table is misconfigured (e.g., if there are misnamed bodyparts in the table). See ConversionTable for more. |
Source code in deeplabcut/modelzoo/utils.py
get_super_animal_project_cfg
Gets the project configuration file for a SuperAnimal model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
the name of the SuperAnimal model for which to load the project configuration |
required |
Returns:
| Type | Description |
|---|---|
dict
|
the project configuration for the given SuperAnimal model |
Source code in deeplabcut/modelzoo/utils.py
get_super_animal_scorer
get_super_animal_scorer(
super_animal: str,
model_snapshot_path: Path | str,
detector_snapshot_path: Path | str | None,
torchvision_detector_name: str | None = None,
) -> str
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The SuperAnimal dataset on which the models were trained |
required |
|
Path | str
|
The path for the SuperAnimal pose model snapshot |
required |
|
Path | str | None
|
The path for the SuperAnimal detector snapshot, if a detector is being used. |
required |
|
str | None
|
The name of a pretrained COCO detector from torchvision, if such a detector is used instead of a snapshot. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The DLC scorer name to use for the given SuperAnimal models. |
Source code in deeplabcut/modelzoo/utils.py
parse_project_model_name
Parses model zoo model names for SuperAnimal models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
the name of the SuperAnimal model name to parse |
required |
Returns:
| Name | Type | Description |
|---|---|---|
project_name |
tuple[str, str]
|
the parsed SuperAnimal model name model_name: the model architecture (e.g., dlcrnet, hrnetw32) |