deeplabcut.pose_estimation_pytorch.models.predictors.base
Classes:
| Name | Description |
|---|---|
BasePredictor |
The base Predictor class. |
BasePredictor
The base Predictor class.
This class is an abstract base class (ABC) for defining predictors used in the DeepLabCut Toolbox. All predictor classes should inherit from this base class and implement the forward method. Regresses keypoint coordinates from a models output maps
Attributes:
| Name | Type | Description |
|---|---|---|
num_animals |
Number of animals in the project. Should be set in subclasses. |
Example
Create a subclass that inherits from BasePredictor and implements the forward method.
class MyPredictor(BasePredictor): def init(self, num_animals): super().init() self.num_animals = num_animals
def forward(self, outputs):
# Implement the forward pass of your custom predictor here.
pass
Methods:
| Name | Description |
|---|---|
forward |
Abstract method for the forward pass of the Predictor. |
Source code in deeplabcut/pose_estimation_pytorch/models/predictors/base.py
forward
abstractmethod
Abstract method for the forward pass of the Predictor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
the stride of the model |
required |
|
dict[str, Tensor]
|
outputs of the model heads |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
A dictionary containing a "poses" key with the output tensor as value, and optionally a "unique_bodyparts" with the unique bodyparts tensor as value. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
This method must be implemented in subclasses. |