Skip to content

deeplabcut.pose_estimation_pytorch.models.necks.base

Classes:

Name Description
BaseNeck

Base Neck class for pose estimation.

BaseNeck

Bases: ABC, Module

Base Neck class for pose estimation.

Methods:

Name Description
forward

Abstract method for the forward pass through the Neck.

Source code in deeplabcut/pose_estimation_pytorch/models/necks/base.py
class BaseNeck(ABC, torch.nn.Module):
    """Base Neck class for pose estimation."""

    def __init__(self):
        super().__init__()

    @abstractmethod
    def forward(self, x: torch.Tensor):
        """Abstract method for the forward pass through the Neck.

        Args:
            x: Input tensor.

        Returns:
            Output tensor.
        """
        pass

    def _init_weights(self, pretrained: str):
        """Initialize the Neck with pretrained weights.

        Args:
            pretrained: Path to the pretrained weights.

        Returns:
            None
        """
        if pretrained:
            self.model.load_state_dict(torch.load(pretrained))

forward abstractmethod

forward(x: Tensor)

Abstract method for the forward pass through the Neck.

Parameters:

Name Type Description Default

x

Tensor

Input tensor.

required

Returns:

Type Description

Output tensor.

Source code in deeplabcut/pose_estimation_pytorch/models/necks/base.py
@abstractmethod
def forward(self, x: torch.Tensor):
    """Abstract method for the forward pass through the Neck.

    Args:
        x: Input tensor.

    Returns:
        Output tensor.
    """
    pass