Calculates the per vertex displacement due to the blend shapes. Parameters ---------- betas : torch.tensor Bx(num_betas) Blend shape coefficients shape_disps: torch.tensor Vx3x(num_betas) Blend shapes Returns ------- torch.tensor BxVx3 The per-ve
(betas: Tensor, shape_disps: Tensor)
| 260 | |
| 261 | |
| 262 | def blend_shapes(betas: Tensor, shape_disps: Tensor) -> Tensor: |
| 263 | """Calculates the per vertex displacement due to the blend shapes. |
| 264 | |
| 265 | Parameters |
| 266 | ---------- |
| 267 | betas : torch.tensor Bx(num_betas) |
| 268 | Blend shape coefficients |
| 269 | shape_disps: torch.tensor Vx3x(num_betas) |
| 270 | Blend shapes |
| 271 | |
| 272 | Returns |
| 273 | ------- |
| 274 | torch.tensor BxVx3 |
| 275 | The per-vertex displacement due to shape deformation |
| 276 | """ |
| 277 | |
| 278 | # Displacement[b, m, k] = sum_{l} betas[b, l] * shape_disps[m, k, l] |
| 279 | # i.e. Multiply each shape displacement by its corresponding beta and |
| 280 | # then sum them. |
| 281 | blend_shape = torch.einsum('bl,mkl->bmk', [betas, shape_disps]) |
| 282 | return blend_shape |
| 283 | |
| 284 | |
| 285 | def batch_rodrigues( |