Hi! I have a very basic question on loading the data to view. I was trying to view the point cloud, mesh, and the body (from the v2 release) using meshplot but ran into the following issues:
import smplx
import torch
import numpy as np
import pickle
import meshplot as mp
import open3d as o3d
import igl
df3d_folder = "../../../Downloads/data/deepfashion3dv2"
pose_folder = os.path.join(df3d_folder, "packed_pose")
pc_folder = os.path.join(df3d_folder, "point_cloud")
fl_folder = os.path.join(df3d_folder, "featureline_annotation")
mesh_folder = os.path.join(df3d_folder, "filtered_registered_mesh")
garment_id = 19 # the first in the short-sleeve upper category
garment_id = str(garment_id)
available_poses = [filename.split(".")[0] for filename in os.listdir(os.path.join(pose_folder, garment_id))]
available_poses = sorted(available_poses)
# available_poses
pose_id = available_poses[0]
fl_id = "_".join(pose_id.split("-"))
# pose_id, fl_id
# load pose and see if I can reconstruct the body
with open(os.path.join(pose_folder, garment_id, pose_id + ".pkl"), "rb") as f:
packed_pose = pickle.load(f)
# packed_pose
model_n = smplx.create("./models/", model_type="smpl", gender="female",
global_orient=packed_pose["pose"][:3].reshape(1, 3),
body_pose=packed_pose["pose"][3:].reshape(1, 69),
transl=packed_pose["trans"].reshape(1, 3),
dtype=torch.float64)
output_n = model_n()
verts_n = output_n.vertices.detach().cpu().numpy().squeeze()
faces_n = model_n.faces
# newvn = (verts_n - offset) * packed_pose["scale"]# + offset
newvn = verts_n * packed_pose["scale"]
# next try to load the .ply files
pcd = o3d.io.read_point_cloud(os.path.join(pc_folder, garment_id, pose_id + ".ply"))
# visualize the garment mesh on body
v, f = igl.read_triangle_mesh(os.path.join(mesh_folder, pose_id, "model_cleaned.obj"))
p = mp.plot(verts_n, faces_n, c=np.array([0.8,1,0.8]))
p.add_mesh(v, f)
p.add_points(np.asarray(pcd.points))
If anyone could help me understand how to correctly load the data to view them that'll be great! Thanks!