deeplabcut.pose_estimation_pytorch.models.heads.rtmcc_head
Modified SimCC head for the RTMPose model.
Based on the official mmpose RTMCC head implementation. For more information, see
https://github.com/open-mmlab/mmpose.
Classes:
| Name | Description |
|---|---|
RTMCCHead |
RTMPose Coordinate Classification head. |
RTMCCHead
Bases: WeightConversionMixin, BaseHead
RTMPose Coordinate Classification head.
The RTMCC head is itself adapted from the SimCC head. For more information, see "SimCC: a Simple Coordinate Classification Perspective for Human Pose Estimation" (https://arxiv.org/pdf/2107.03332) and "RTMPose: Real-Time Multi-Person Pose Estimation based on MMPose" (https://arxiv.org/pdf/2303.07399).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
tuple[int, int]
|
The size of images given to the pose estimation model. |
required |
|
int
|
The number of input channels for the head. |
required |
|
int
|
Number of channels output by the head (number of bodyparts). |
required |
|
tuple[int, int]
|
The size of the input feature map for the head. This is equal to the input_size divided by the backbone stride. |
required |
|
float
|
The split ratio of pixels, as described in SimCC. |
required |
|
int
|
Kernel size of the final convolutional layer. |
required |
|
dict
|
Configuration for the GatedAttentionUnit. |
required |
|
BasePredictor
|
The predictor for the head. Should usually be a |
required |
|
BaseGenerator
|
The target generator for the head. Should usually be a
|
required |
|
dict[str, BaseCriterion]
|
The loss criterions for the RTMCC outputs. There should be a criterion for "x" and a criterion for "y". |
required |
|
BaseLossAggregator
|
The loss aggregator to combine the losses. |
required |
|
str | dict | BaseWeightInitializer | None
|
The weight initializer to use for the head. |
None
|
Methods:
| Name | Description |
|---|---|
convert_weights |
Re-order / subset bodypart (token) channels for transfer from SuperAnimal. |
update_input_size |
Updates an RTMPose model configuration file for a new image input size. |
Source code in deeplabcut/pose_estimation_pytorch/models/heads/rtmcc_head.py
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 127 128 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 | |
convert_weights
staticmethod
convert_weights(
state_dict: dict[str, Tensor], module_prefix: str, conversion: Tensor, *, omit_gau_w: bool = False
) -> dict[str, torch.Tensor]
Re-order / subset bodypart (token) channels for transfer from SuperAnimal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, Tensor]
|
State dict for this head. |
required |
|
str
|
Prefix for state-dict keys. |
required |
|
Tensor
|
Mapping from new bodyparts to source bodyparts. |
required |
|
bool
|
If True, remove |
False
|
Source code in deeplabcut/pose_estimation_pytorch/models/heads/rtmcc_head.py
update_input_size
staticmethod
Updates an RTMPose model configuration file for a new image input size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
The model configuration to update in-place. |
required |
|
tuple[int, int]
|
The updated input (width, height). |
required |