Convert 276-dim motion representation to 3D joints for MBench evaluation. Args: motion_tensor: Shape (frames, 276) raw motion representation Returns: joints: Shape (frames, 22, 3) 3D joint positions
(motion_tensor: torch.Tensor)
| 64 | |
| 65 | |
| 66 | def convert_motion_to_joints(motion_tensor: torch.Tensor) -> np.ndarray: |
| 67 | """ |
| 68 | Convert 276-dim motion representation to 3D joints for MBench evaluation. |
| 69 | |
| 70 | Args: |
| 71 | motion_tensor: Shape (frames, 276) raw motion representation |
| 72 | |
| 73 | Returns: |
| 74 | joints: Shape (frames, 22, 3) 3D joint positions |
| 75 | """ |
| 76 | from motion_rep.retarget_motion import motion_rep_to_SMPL |
| 77 | |
| 78 | # Extract SMPL parameters and recovered joints |
| 79 | smpl_data, recovered_joints = motion_rep_to_SMPL( |
| 80 | motion_tensor, |
| 81 | recover_from_velocity=True, |
| 82 | equal_length=False, |
| 83 | ) |
| 84 | |
| 85 | # Apply coordinate conversion (same as mbench_render.py) |
| 86 | # recovered_joints shape: (frames, 22, 3) |
| 87 | joints = torch.einsum("ij,tvj->tvi", COORD_CONVERSION, recovered_joints) |
| 88 | |
| 89 | return joints.numpy().astype("float32") |
| 90 | |
| 91 | |
| 92 | def find_motion_file(folder_path: Path) -> Path: |
no test coverage detected