text stringlengths 0 93.6k |
|---|
if recording_name not in ground_pene_dist_list.keys(): |
ground_pene_dist_list[recording_name] = [] |
ground_pene_freq_list[recording_name] = [] |
ground_pene_dist_list[recording_name].append(pene_dist) |
ground_pene_freq_list[recording_name].append(pene_freq) |
else: |
ground_pene_dist_list[recording_name].append(pene_dist) |
ground_pene_freq_list[recording_name].append(pene_freq) |
if args.visualize or args.render: |
############ get smplx vertices |
smpl_verts_rec_list = [] |
joints_rec_list = [] |
smpl_verts_input_list = [] |
joints_input_list = [] |
with torch.no_grad(): |
for idx in tqdm(range(n_seq)): |
cur_total_dim = 0 |
repr_dict_rec = {} |
repr_dict_input = {} |
for repr_name in repr_name_list: |
repr_dict_rec[repr_name] = motion_repr_rec_list[idx:(idx + 1), ..., cur_total_dim:(cur_total_dim + repr_dim_dict[repr_name])] |
repr_dict_rec[repr_name] = torch.from_numpy(repr_dict_rec[repr_name]).to(dist_util.dev()) |
repr_dict_input[repr_name] = motion_repr_noisy_list[idx:(idx + 1), ..., cur_total_dim:(cur_total_dim + repr_dim_dict[repr_name])] |
repr_dict_input[repr_name] = torch.from_numpy(repr_dict_input[repr_name]).to(dist_util.dev()) |
cur_total_dim += repr_dim_dict[repr_name] |
joints_rec, smpl_verts_rec = recover_from_repr_smpl(repr_dict_rec, recover_mode='smplx_params', smplx_model=smplx_neutral, return_verts=True, return_full_joints=True) |
joints_input, smpl_verts_input = recover_from_repr_smpl(repr_dict_input, recover_mode='smplx_params', smplx_model=smplx_neutral, return_verts=True, return_full_joints=True) |
smpl_verts_rec_list.append(smpl_verts_rec.detach().cpu().numpy()) |
joints_rec_list.append(joints_rec.detach().cpu().numpy()) |
smpl_verts_input_list.append(smpl_verts_input.detach().cpu().numpy()) |
joints_input_list.append(joints_input.detach().cpu().numpy()) |
smpl_verts_rec_list = np.concatenate(smpl_verts_rec_list, axis=0) |
joints_rec_list = np.concatenate(joints_rec_list, axis=0) |
smpl_verts_input_list = np.concatenate(smpl_verts_input_list, axis=0) |
joints_input_list = np.concatenate(joints_input_list, axis=0) |
########### transform back to scene coord |
for seq_idx in range(n_seq): |
cur_verts_scene_coord = points_coord_trans(smpl_verts_rec_list[seq_idx].reshape(-1, 3), np.linalg.inv(trans_scene2cano_list[seq_idx])) |
smpl_verts_rec_list[seq_idx] = cur_verts_scene_coord.reshape(clip_len_rec, -1, 3) |
cur_joints_scene_coord = points_coord_trans(joints_rec_list[seq_idx].reshape(-1, 3), np.linalg.inv(trans_scene2cano_list[seq_idx])) |
joints_rec_list[seq_idx] = cur_joints_scene_coord.reshape(clip_len_rec, -1, 3) |
cur_verts_scene_coord = points_coord_trans(smpl_verts_input_list[seq_idx].reshape(-1, 3), np.linalg.inv(trans_scene2cano_list[seq_idx])) |
smpl_verts_input_list[seq_idx] = cur_verts_scene_coord.reshape(clip_len_rec, -1, 3) |
cur_joints_scene_coord = points_coord_trans(joints_input_list[seq_idx].reshape(-1, 3), np.linalg.inv(trans_scene2cano_list[seq_idx])) |
joints_input_list[seq_idx] = cur_joints_scene_coord.reshape(clip_len_rec, -1, 3) |
####################################### visualization ############################# |
if args.visualize: |
for bs in range(0, n_seq, 1): |
if bs % args.vis_interval == 0: |
for t in range(0, clip_len_rec, 1): |
################################# body skeletons |
cur_joint_mask_vis = mask_joint_vis_list[bs, t] # [22] |
cur_mask_joint_id = np.where(cur_joint_mask_vis == 0)[0].tolist() |
skeleton_input_list = vis_skeleton(joints=joints_input_list[bs, t], limbs=LIMBS_BODY_SMPL, |
mask_scheme='video', cur_mask_joint_id=cur_mask_joint_id, |
color_occ=[0, 128 / 255, 0], color_vis=[0, 128 / 255, 0]) |
skeleton_rec_list = vis_skeleton(joints=joints_rec_list[bs, t], limbs=LIMBS_BODY_SMPL, |
mask_scheme='video', cur_mask_joint_id=cur_mask_joint_id) |
################################# foot contact labels |
foot_sphere_rec_list = vis_foot_contact(joints=joints_rec_list[bs, t], contact_lbl=contact_lbl_rec_list[bs, t]) |
################################# body mesh |
body_mesh_rec = o3d.geometry.TriangleMesh() |
body_mesh_rec.vertices = o3d.utility.Vector3dVector(smpl_verts_rec_list[bs, t]) |
body_mesh_rec.triangles = o3d.utility.Vector3iVector(smplx_neutral.faces) |
body_mesh_rec.compute_vertex_normals() |
body_mesh_rec.paint_uniform_color(COLOR_VIS_O3D) |
body_mesh_input = o3d.geometry.TriangleMesh() |
body_mesh_input.vertices = o3d.utility.Vector3dVector(smpl_verts_input_list[bs, t]) |
body_mesh_input.triangles = o3d.utility.Vector3iVector(smplx_neutral.faces) |
body_mesh_input.compute_vertex_normals() |
body_mesh_input.paint_uniform_color([0, 128 / 255, 0]) |
if args.vis_option == 'mesh': |
vis.add_geometry(body_mesh_rec) |
vis.add_geometry(body_mesh_input) |
if args.vis_option == 'skeleton': |
for arrow in skeleton_rec_list: |
vis.add_geometry(arrow) |
for arrow in skeleton_input_list: |
vis.add_geometry(arrow) |
for sphere in foot_sphere_rec_list: |
vis.add_geometry(sphere) |
ctr = vis.get_view_control() |
cam_param = ctr.convert_to_pinhole_camera_parameters() |
cam_param = update_cam(cam_param, cam2world) |
ctr.convert_from_pinhole_camera_parameters(cam_param) |
vis.poll_events() |
vis.update_renderer() |
# time.sleep(0.03) |
if args.vis_option == 'mesh': |
vis.remove_geometry(body_mesh_rec) |
vis.remove_geometry(body_mesh_input) |
if args.vis_option == 'skeleton': |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.