MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / convert_motion_to_joints

Function convert_motion_to_joints

scripts/organize_mbench_results.py:66–89  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

64
65
66def 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
92def find_motion_file(folder_path: Path) -> Path:

Callers 1

mainFunction · 0.85

Calls 1

motion_rep_to_SMPLFunction · 0.90

Tested by

no test coverage detected