diff --git a/cloth3d/read.py b/cloth3d/read.py index 03ab45c..15a781b 100644 --- a/cloth3d/read.py +++ b/cloth3d/read.py @@ -80,7 +80,7 @@ class DataReader: """ def read_garment_vertices(self, sample, garment, frame, trans, zrot): # Read garment vertices (relative to root joint) - pc16_path = os.path.join(self.SRC, sample, garment + '_registered.pc16') + pc16_path = os.path.join(self.SRC, sample, garment + '.pc16') V = readPC2Frame(pc16_path, frame, True) # Read sample data if trans is not None: diff --git a/data/dataset.py b/data/dataset.py index cb4ef54..b81e006 100644 --- a/data/dataset.py +++ b/data/dataset.py @@ -104,7 +104,7 @@ class Dataset(Dataset): else: view = torch.eye(3, device=self.device) - combined = torch.concat((body, mesh_posed[mesh_mask, :])) + combined = torch.concat((body, mesh_posed)) # combined_no_trans = torch.concat((body_no_trans, mesh_posed_no_trans[mesh_mask, :])) combined_faces = torch.Tensor(np.concatenate((body_faces, faces + body.shape[0]))).to(self.device) diff --git a/data/preprocess.py b/data/preprocess.py index 0d62503..ee3bea1 100644 --- a/data/preprocess.py +++ b/data/preprocess.py @@ -30,12 +30,11 @@ def generate_frames_file(folder, file_name): garment_dir = os.path.join(folder, id) if not os.path.isdir(garment_dir): continue - garments = [f.replace('_registered.pc16','') for f in os.listdir(garment_dir) if f.endswith('_registered.pc16') and not f.startswith('Combined')] - assert len(garments) == 1 - garment = garments[0] - verts = readPC2(os.path.join(garment_dir, garment + '_registered.pc16'), True)['V'] - for i in range(verts.shape[0]): - frames.append(Frame(id, i, garment)) + garments = [f.replace('.obj','') for f in os.listdir(garment_dir) if f.endswith('.obj')] + info = loadInfo(os.path.join(garment_dir, 'info')) + garments_str = ' '.join(garments) + for i in range(info['poses'].shape[1]): + frames.append(Frame(id, i, garments_str)) with open(os.path.join(folder, file_name), 'w') as f: for i, frame in enumerate(frames): diff --git a/test.py b/test.py index 241bbfc..ad2b19b 100644 --- a/test.py +++ b/test.py @@ -58,7 +58,7 @@ def plot3d_with_mesh(depth, mesh, info, root_dist, scale, mask, root_joint_pixel return out - pc = cameras.unproject_points(depth) + # pc = cameras.unproject_points(depth) mask = restore(mask[:,None,:,:], scale, root_joint_pixel).to(torch.bool) depth = restore(depth, scale, root_joint_pixel, root_dist) * mask pc = kornia.geometry.depth.depth_to_3d(depth, K, normalize_points=True)