Apply DeciWatch framework for 10x efficiency. "DeciWatch: A Simple Baseline for 10× Efficient 2D and 3D Pose Estimation", arXiv'2022. More details can be found in the `paper ` . Args: input_dim (int): The size of input spatial dimension,
| 163 | |
| 164 | |
| 165 | class DeciWatch(nn.Module): |
| 166 | """Apply DeciWatch framework for 10x efficiency. |
| 167 | "DeciWatch: A Simple Baseline for 10× Efficient 2D and 3D Pose Estimation", |
| 168 | arXiv'2022. More details can be found in the `paper |
| 169 | <https://arxiv.org/pdf/2203.08713>` . |
| 170 | Args: |
| 171 | input_dim (int): The size of input spatial dimension, |
| 172 | e.g., 15*2 for 2d pose on the jhmdb dataset |
| 173 | sample_interval (int): DeciWatch argument. See :class:`DeciWatch` |
| 174 | for details. The intervals of the uniform sampling. |
| 175 | The sampling ratio is: 1/sample_interval. Default: 10 |
| 176 | encoder_hidden_dim (int): DeciWatch argument. See :class:`DeciWatch` |
| 177 | for details. Hidden dimension in the encoder. Default: 64 |
| 178 | decoder_hidden_dim (int): DeciWatch argument. See :class:`DeciWatch` |
| 179 | for details. Hidden dimension in the decoder. Default: 64 |
| 180 | dropout (float): DeciWatch argument. See :class:`DeciWatch` |
| 181 | for details. dropout probability. Default: 0.1 |
| 182 | nheads (int): DeciWatch argument. See :class:`DeciWatch` |
| 183 | for details. Default: 4 |
| 184 | dim_feedforward (int): DeciWatch argument. See :class:`DeciWatch` |
| 185 | for details. Dimension of feed forward layers. |
| 186 | enc_layers (int): DeciWatch argument. See :class:`DeciWatch` |
| 187 | for details. Layers of the encoder. Default: 5 |
| 188 | dec_layers (int): DeciWatch argument. See :class:`DeciWatch` |
| 189 | for details. Layers of the encoder. Default: 5 |
| 190 | activation (str): DeciWatch argument. See :class:`DeciWatch` |
| 191 | for details. Activation function in deciwatch. |
| 192 | Default: 'leaky_relu' |
| 193 | pre_norm (bool): DeciWatch argument. See :class:`DeciWatch` |
| 194 | for details. Whether to normalize before positional embedding. |
| 195 | Default: False |
| 196 | """ |
| 197 | |
| 198 | def __init__(self, |
| 199 | input_dim=24 * 6, |
| 200 | sample_interval=10, |
| 201 | encoder_hidden_dim=16, |
| 202 | decoder_hidden_dim=16, |
| 203 | dropout=0.1, |
| 204 | nheads=4, |
| 205 | dim_feedforward=256, |
| 206 | enc_layers=3, |
| 207 | dec_layers=3, |
| 208 | activation='leaky_relu', |
| 209 | pre_norm=False): |
| 210 | super(DeciWatch, self).__init__() |
| 211 | self.pos_embed_dim = encoder_hidden_dim |
| 212 | self.pos_embed = self.build_position_encoding(self.pos_embed_dim) |
| 213 | |
| 214 | self.sample_interval = sample_interval |
| 215 | |
| 216 | self.deciwatch_par = { |
| 217 | 'input_dim': input_dim, |
| 218 | 'encoder_hidden_dim': encoder_hidden_dim, |
| 219 | 'decoder_hidden_dim': decoder_hidden_dim, |
| 220 | 'dropout': dropout, |
| 221 | 'nheads': nheads, |
| 222 | 'dim_feedforward': dim_feedforward, |