deeplabcut.pose_estimation_pytorch.models.backbones.resnet
Classes:
| Name | Description |
|---|---|
ResNet |
ResNet backbone. |
ResNet
Bases: BaseBackbone
ResNet backbone.
This class represents a typical ResNet backbone for pose estimation.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
the ResNet model |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the ResNet backbone. |
forward |
Forward pass through the ResNet backbone. |
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/resnet.py
__init__
__init__(
model_name: str = "resnet50",
output_stride: int = 32,
pretrained: bool = False,
drop_path_rate: float = 0.0,
drop_block_rate: float = 0.0,
**kwargs
) -> None
Initialize the ResNet backbone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Name of the ResNet model to use, e.g., 'resnet50', 'resnet101' |
'resnet50'
|
|
int
|
Output stride of the network, 32, 16, or 8. |
32
|
|
bool
|
If True, initializes with ImageNet pretrained weights. |
False
|
|
float
|
Stochastic depth drop-path rate |
0.0
|
|
float
|
Drop block rate |
0.0
|
|
BaseBackbone kwargs |
{}
|
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/resnet.py
forward
Forward pass through the ResNet backbone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
Input tensor. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
torch.Tensor: Output tensor. |
Example: >>> import torch >>> from deeplabcut.pose_estimation_pytorch.models.backbones import ResNet >>> backbone = ResNet(model_name='resnet50', pretrained=False) >>> x = torch.randn(1, 3, 256, 256) >>> y = backbone(x)
Expected Output Shape:
If input size is (batch_size, 3, shape_x, shape_y), the output shape
will be (batch_size, 3, shape_x//16, shape_y//16)