Skip to content

deeplabcut.pose_estimation_pytorch.config.paf_parameters

Functions:

Name Description
get_paf_parameters

Gets values for PAF parameters from the project configuration.

get_paf_parameters

get_paf_parameters(
    project_config: dict, bodyparts: list[str], num_limbs_threshold: int = 105, paf_graph_degree: int = 6
) -> dict

Gets values for PAF parameters from the project configuration.

Source code in deeplabcut/pose_estimation_pytorch/config/paf_parameters.py
def get_paf_parameters(
    project_config: dict,
    bodyparts: list[str],
    num_limbs_threshold: int = 105,
    paf_graph_degree: int = 6,
) -> dict:
    """Gets values for PAF parameters from the project configuration."""
    from deeplabcut.utils import auxfun_multianimal

    paf_graph = [[i, j] for i in range(len(bodyparts)) for j in range(i + 1, len(bodyparts))]
    num_limbs = len(paf_graph)
    # If the graph is unnecessarily large (with 15+ keypoints by default),
    # we randomly prune it to a size guaranteeing an average node degree of 6;
    # see Suppl. Fig S9c in Lauer et al., 2022.
    if num_limbs >= num_limbs_threshold:
        paf_graph = auxfun_multianimal.prune_paf_graph(
            paf_graph,
            average_degree=paf_graph_degree,
        )
        num_limbs = len(paf_graph)
    return {
        "paf_graph": paf_graph,
        "num_limbs": num_limbs,
        "paf_edges_to_keep": project_config.get("paf_best", list(range(num_limbs))),
    }