deeplabcut.pose_estimation_pytorch.models.backbones.hrnet
Classes:
| Name | Description |
|---|---|
HRNet |
HRNet backbone. |
HRNet
Bases: BaseBackbone
HRNet backbone.
This version returns high-resolution feature maps of size 1/4 * original_image_size. This is obtained using bilinear interpolation and concatenation of all the outputs of the HRNet stages.
The model outputs 4 branches, with strides 4, 8, 16 and 32.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
The stride of the HRNet. Should always be 4, except for custom models. |
4
|
|
str
|
Any HRNet variant available through timm (e.g., 'hrnet_w32', 'hrnet_w48'). See timm for more options. |
'hrnet_w32'
|
|
bool
|
If True, loads the backbone with ImageNet pretrained weights from timm. |
False
|
|
bool
|
Needed for DEKR. Instead of returning features from the high-resolution branch, interpolates all other branches to the same shape and concatenates them. |
False
|
|
bool
|
As described by timm, it "allows grabbing increased channel count features using part of the classification head" (otherwise, the default features are returned). |
False
|
|
BaseBackbone kwargs |
{}
|
Attributes:
| Name | Type | Description |
|---|---|---|
model |
the HRNet model |
Methods:
| Name | Description |
|---|---|
forward |
Forward pass through the HRNet backbone. |
Source code in deeplabcut/pose_estimation_pytorch/models/backbones/hrnet.py
forward
Forward pass through the HRNet backbone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
Input tensor of shape (batch_size, channels, height, width). |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
the feature map |
Example
import torch from deeplabcut.pose_estimation_pytorch.models.backbones import HRNet backbone = HRNet(model_name='hrnet_w32', pretrained=False) x = torch.randn(1, 3, 256, 256) y = backbone(x)