MCPcopy Create free account
hub / github.com/MotrixLab/MotionDiffuse / recover_from_rot

Function recover_from_rot

text2motion/utils/motion_process.py:384–398  ·  view source on GitHub ↗
(data, joints_num, skeleton)

Source from the content-addressed store, hash-verified

382
383
384def recover_from_rot(data, joints_num, skeleton):
385 r_rot_quat, r_pos = recover_root_rot_pos(data)
386
387 r_rot_cont6d = quaternion_to_cont6d(r_rot_quat)
388
389 start_indx = 1 + 2 + 1 + (joints_num - 1) * 3
390 end_indx = start_indx + (joints_num - 1) * 6
391 cont6d_params = data[..., start_indx:end_indx]
392 # print(r_rot_cont6d.shape, cont6d_params.shape, r_pos.shape)
393 cont6d_params = torch.cat([r_rot_cont6d, cont6d_params], dim=-1)
394 cont6d_params = cont6d_params.view(-1, joints_num, 6)
395
396 positions = skeleton.forward_kinematics_cont6d(cont6d_params, r_pos)
397
398 return positions
399
400
401def recover_from_ric(data, joints_num):

Callers

nothing calls this directly

Calls 3

recover_root_rot_posFunction · 0.85
quaternion_to_cont6dFunction · 0.85

Tested by

no test coverage detected