Apply affine transformation defined by the transform matrix on the joints. Args: joints (np.ndarray[..., 2]): Origin coordinate of joints. mat (np.ndarray[3, 2]): The affine matrix. Returns: matrix (np.ndarray[..., 2]): Result coordinate of joints.
(joints, mat)
| 335 | |
| 336 | |
| 337 | def warp_affine_joints(joints, mat): |
| 338 | """Apply affine transformation defined by the transform matrix on the |
| 339 | joints. |
| 340 | |
| 341 | Args: |
| 342 | joints (np.ndarray[..., 2]): Origin coordinate of joints. |
| 343 | mat (np.ndarray[3, 2]): The affine matrix. |
| 344 | |
| 345 | Returns: |
| 346 | matrix (np.ndarray[..., 2]): Result coordinate of joints. |
| 347 | """ |
| 348 | joints = np.array(joints) |
| 349 | shape = joints.shape |
| 350 | joints = joints.reshape(-1, 2) |
| 351 | return np.dot( |
| 352 | np.concatenate((joints, joints[:, 0:1] * 0 + 1), axis=1), |
| 353 | mat.T).reshape(shape) |
| 354 | |
| 355 | |
| 356 | def _calc_distances(preds, targets, mask, normalize): |