MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / get_cont6d_params

Function get_cont6d_params

mGPT/data/humanml/scripts/motion_process.py:98–117  ·  view source on GitHub ↗
(positions)

Source from the content-addressed store, hash-verified

96 return quat_params, r_velocity, velocity, r_rot
97
98 def get_cont6d_params(positions):
99 skel = Skeleton(n_raw_offsets, kinematic_chain, "cpu")
100 # (seq_len, joints_num, 4)
101 quat_params = skel.inverse_kinematics_np(positions, face_joint_indx, smooth_forward=True)
102
103 '''Quaternion to continuous 6D'''
104 cont_6d_params = quaternion_to_cont6d_np(quat_params)
105 # (seq_len, 4)
106 r_rot = quat_params[:, 0].copy()
107 # print(r_rot[0])
108 '''Root Linear Velocity'''
109 # (seq_len - 1, 3)
110 velocity = (positions[1:, 0] - positions[:-1, 0]).copy()
111 # print(r_rot.shape, velocity.shape)
112 velocity = qrot_np(r_rot[1:], velocity)
113 '''Root Angular Velocity'''
114 # (seq_len - 1, 4)
115 r_velocity = qmul_np(r_rot[1:], qinv_np(r_rot[:-1]))
116 # (seq_len, joints_num, 4)
117 return cont_6d_params, r_velocity, velocity, r_rot
118
119 cont_6d_params, r_velocity, velocity, r_rot = get_cont6d_params(positions)
120 positions = get_rifke(positions)

Callers 2

extract_featuresFunction · 0.85
process_fileFunction · 0.85

Calls 6

inverse_kinematics_npMethod · 0.95
SkeletonClass · 0.85
quaternion_to_cont6d_npFunction · 0.85
qrot_npFunction · 0.85
qmul_npFunction · 0.85
qinv_npFunction · 0.85

Tested by

no test coverage detected