(data, joints_num)
| 89 | |
| 90 | |
| 91 | def recover_from_ric(data, joints_num): |
| 92 | r_rot_quat, r_pos = recover_root_rot_pos(data) |
| 93 | positions = data[..., 4:(joints_num - 1) * 3 + 4] |
| 94 | positions = positions.view(positions.shape[:-1] + (-1, 3)) |
| 95 | '''Add Y-axis rotation to local joints''' |
| 96 | rot = qinv(r_rot_quat[..., None, :]).expand(positions.shape[:-1] + (4, )) |
| 97 | positions = qrot(rot, positions) |
| 98 | '''Add root XZ to joints''' |
| 99 | positions[..., 0] += r_pos[..., 0:1] |
| 100 | positions[..., 2] += r_pos[..., 2:3] |
| 101 | '''Concate root and joints''' |
| 102 | positions = torch.cat([r_pos.unsqueeze(-2), positions], dim=-2) |
| 103 | |
| 104 | return positions |
| 105 | |
| 106 | |
| 107 | def plot_3d_motion(save_path, |
no test coverage detected