Skip to content

No parsing for .npy files #11

@Jameson-Crate

Description

@Jameson-Crate

I realized that there was no option for parsing .npy files in sft/datasets/dataset.py even though the training instructions say to pass in a .npy file of dimensions Nx6 where the first three columns are position and the last three columns are normals. Is there any chance we could get a more detailed clarification of how to organize input files (.ply, .obj, .npy)? Thank you!

  def __getitem__(self, idx: int) -> Dict:
      data = {}
      if self.uid_list[idx].split(".")[-1] == "obj":
          mesh         = trimesh.load(f"{self.path}/{self.uid_list[idx]}")
          verts, faces = mesh.vertices,mesh.faces
          indices      = np.random.choice(50000, self.point_num, replace=False)
          pc_normal    = sample_pc(verts, faces, pc_num=50000, with_normal=True)[indices]
      elif self.uid_list[idx].split(".")[-1] == "ply":
          p             = o3d.io.read_point_cloud(f"{self.path}/{self.uid_list[idx]}")
          pc_normal     = np.concatenate([np.asarray(p.points)[:,[2,0,1]],np.asarray(p.normals)[:,[2,0,1]]],axis=1)
          if len(pc_normal)>self.point_num:
              indices   = np.random.choice(len(pc_normal), self.point_num, replace=False)
          pc_normal     = pc_normal[indices]
      data['pc_normal'] = torch.tensor(pc_normal)
      return data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions