deeplabcut.pose_estimation_pytorch.models.backbones.base
Classes:
| Name | Description |
|---|---|
BaseBackbone |
Base Backbone class for pose estimation. |
HuggingFaceWeightsMixin |
Mixin for backbones where the pretrained weights are stored on HuggingFace. |
BaseBackbone
Base Backbone class for pose estimation.
Attributes:
| Name | Type | Description |
|---|---|---|
stride |
the stride for the backbone |
|
freeze_bn_weights |
freeze weights of batch norm layers during training |
|
freeze_bn_stats |
freeze stats of batch norm layers during training |
Methods:
| Name | Description |
|---|---|
forward |
Abstract method for the forward pass through the backbone. |
freeze_batch_norm_layers |
Freezes batch norm layers. |
train |
Sets the module in training or evaluation mode. |
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/base.py
forward
abstractmethod
Abstract method for the forward pass through the backbone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
Input tensor of shape (batch_size, channels, height, width). |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
a feature map for the input, of shape (batch_size, c', h', w') |
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/base.py
freeze_batch_norm_layers
Freezes batch norm layers.
Running mean + var are always given to F.batch_norm, except when the layer is
in train mode and track_running_stats is False, see
https://pytorch.org/docs/stable/_modules/torch/nn/modules/batchnorm.html
So to 'freeze' the running stats, the only way is to set the layer to "eval"
mode.
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/base.py
train
Sets the module in training or evaluation mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
whether to set training mode (True) or evaluation mode (False) |
True
|
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/base.py
HuggingFaceWeightsMixin
Mixin for backbones where the pretrained weights are stored on HuggingFace.
Methods:
| Name | Description |
|---|---|
download_weights |
Downloads the backbone weights from the HuggingFace repo. |
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/base.py
download_weights
Downloads the backbone weights from the HuggingFace repo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The name of the model file to download in the repo. |
required |
|
bool
|
Whether to re-download the file if it already exists locally. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The path to the model snapshot. |