deeplabcut.pose_estimation_pytorch.models.heads.simple_head
Classes:
| Name | Description |
|---|---|
DeconvModule |
Deconvolutional module to predict maps from the extracted features. |
HeatmapHead |
Deconvolutional head to predict maps from the extracted features. |
DeconvModule
Bases: Module
Deconvolutional module to predict maps from the extracted features.
Methods:
| Name | Description |
|---|---|
__init__ |
Args: |
convert_weights |
Converts pre-trained weights to be fine-tuned on another dataset. |
forward |
Forward pass of the HeatmapHead. |
Source code in deeplabcut/pose_estimation_pytorch/models/heads/simple_head.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
__init__
__init__(channels: list[int], kernel_size: list[int], strides: list[int], final_conv: dict | None = None) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
list[int]
|
List containing the number of input and output channels for each deconvolutional layer. |
required |
|
list[int]
|
List containing the kernel size for each deconvolutional layer. |
required |
|
list[int]
|
List containing the stride for each deconvolutional layer. |
required |
|
dict | None
|
Configuration for a conv layer after the deconvolutional layers, if one should be added. Must have keys "out_channels" and "kernel_size". |
None
|
Source code in deeplabcut/pose_estimation_pytorch/models/heads/simple_head.py
convert_weights
staticmethod
convert_weights(state_dict: dict[str, Tensor], module_prefix: str, conversion: Tensor) -> dict[str, torch.Tensor]
Converts pre-trained weights to be fine-tuned on another dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, Tensor]
|
the state dict for the pre-trained model |
required |
|
str
|
the prefix for weights in this head (e.g., 'heads.bodypart') |
required |
|
Tensor
|
the mapping of old indices to new indices |
required |
Source code in deeplabcut/pose_estimation_pytorch/models/heads/simple_head.py
HeatmapHead
Bases: WeightConversionMixin, BaseHead
Deconvolutional head to predict maps from the extracted features.
This class implements a simple deconvolutional head to predict maps from the extracted features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
BasePredictor
|
The predictor used to transform heatmaps into keypoints. |
required |
|
BaseGenerator
|
The module to generate target heatmaps from keypoints. |
required |
|
dict[str, BaseCriterion] | BaseCriterion
|
The loss criterion(s) for the head. |
required |
|
BaseLossAggregator | None
|
The loss aggregator to use, if multiple criterions are used. |
required |
|
dict
|
The configuration for the heatmap outputs of the head. |
required |
|
dict | None
|
The configuration for the location refinement outputs (None if no location refinement should be used). |
None
|
|
str | dict | BaseWeightInitializer | None
|
The way to initialize weights for the head. If None, default
PyTorch initialization is used. Otherwise, a BaseWeightInitializer can be
given (or a configuration for a BaseWeightInitializer). To initialize
the weights with a normal distribution, you could pass
|
None
|
Methods:
| Name | Description |
|---|---|
convert_weights |
Converts pre-trained weights to be fine-tuned on another dataset. |
Source code in deeplabcut/pose_estimation_pytorch/models/heads/simple_head.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
convert_weights
staticmethod
convert_weights(state_dict: dict[str, Tensor], module_prefix: str, conversion: Tensor) -> dict[str, torch.Tensor]
Converts pre-trained weights to be fine-tuned on another dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, Tensor]
|
the state dict for the pre-trained model |
required |
|
str
|
the prefix for weights in this head (e.g., 'heads.bodypart.') |
required |
|
Tensor
|
the mapping of old indices to new indices |
required |