(smpl_params, joints)
| 11 | |
| 12 | |
| 13 | def collect_motion_rep_DART(smpl_params, joints): |
| 14 | # follow DART: (https://arxiv.org/pdf/2410.05260), final motion: (seq_len, 276) |
| 15 | seq_len = smpl_params['transl'].shape[0] |
| 16 | # global_orient & angle velocity of global_orient |
| 17 | global_orient_aa = smpl_params['global_orient'].view(seq_len, 3) # (seq_len, 3) |
| 18 | rot_R = axis_angle_to_mat3x3(global_orient_aa) # (seq_len, 3, 3) |
| 19 | rot_vel = torch.matmul(rot_R[1:], rot_R[:-1].transpose(-1, -2)) # (seq_len-1, 3, 3) |
| 20 | # Use Rot6D as representation |
| 21 | rot_6D = mat3x3_to_rot6d(rot_R) # Shape: (seq_len, 6) |
| 22 | rot_vel_6D = mat3x3_to_rot6d(rot_vel) # Shape: (seq_len-1, 6) |
| 23 | |
| 24 | # translation & velocity of translation |
| 25 | trans = smpl_params['transl'] # Shape: (seq_len, 3) |
| 26 | trans_vel = smpl_params['transl'][1:] - smpl_params['transl'][:-1] # Shape: (seq_len-1, 3) |
| 27 | |
| 28 | # joints & velocity of joints |
| 29 | joints = joints.reshape(seq_len, -1) # Shape: (seq_len, joints_num*3) |
| 30 | joints_vel = (joints[1:] - joints[:-1]) # Shape: (seq_len-1, joints_num*3) |
| 31 | |
| 32 | # body poses axis-angle -> Rot6D |
| 33 | body_poses = smpl_params['body_pose'].reshape(-1, 3) # Shape: (seq_len*(joints_num-1), 3) |
| 34 | body_poses = axis_angle_to_rot6d(body_poses).reshape(seq_len, -1) # Shape: (seq_len, (joints_num-1)*6) |
| 35 | |
| 36 | motion = torch.cat([body_poses[:-1], joints[:-1], joints_vel, rot_6D[:-1], rot_vel_6D, trans[:-1], trans_vel], dim=-1) |
| 37 | return motion |
| 38 | |
| 39 | def motion_rep_to_SMPL(motion, recover_from_velocity=False, equal_length=False): |
| 40 | """ |
no test coverage detected