(self, phase="train", data_dir="../data/chair")
| 44 | |
| 45 | class ChairDataset(torch.utils.data.Dataset): |
| 46 | def __init__(self, phase="train", data_dir="../data/chair"): |
| 47 | super().__init__() |
| 48 | self.data_dir = data_dir |
| 49 | self.phase = phase |
| 50 | |
| 51 | with open(os.path.join(self.data_dir, "all.txt")) as f: |
| 52 | lines = f.readlines() |
| 53 | self.models = [line.rstrip() for line in lines] |
| 54 | |
| 55 | self.k = 20 |
| 56 | |
| 57 | with open(os.path.join(self.data_dir, "%s.txt" % self.phase)) as f: |
| 58 | lines = f.readlines() |
| 59 | self.ids = [int(line.rstrip()) for line in lines] |
| 60 | |
| 61 | self.pc = np.load(os.path.join( |
| 62 | self.data_dir, "pc_4096.npy"), allow_pickle=True) |
| 63 | self.key_pts = np.load(os.path.join( |
| 64 | self.data_dir, "key_point_50.npy"), allow_pickle=True) |
| 65 | self.mesh_vertices = np.load(os.path.join( |
| 66 | self.data_dir, "mesh_vertices.npy"), allow_pickle=True) |
| 67 | self.mesh_faces = np.load(os.path.join( |
| 68 | self.data_dir, "mesh_faces.npy"), allow_pickle=True) |
| 69 | # biharmonic weights |
| 70 | self.w_pc = np.load(os.path.join( |
| 71 | self.data_dir, "w_pc_4096.npy"), allow_pickle=True) |
| 72 | w_mesh_0 = np.load(os.path.join( |
| 73 | self.data_dir, "w_mesh_0.npy"), allow_pickle=True) |
| 74 | w_mesh_1 = np.load(os.path.join( |
| 75 | self.data_dir, "w_mesh_1.npy"), allow_pickle=True) |
| 76 | w_mesh_2 = np.load(os.path.join( |
| 77 | self.data_dir, "w_mesh_2.npy"), allow_pickle=True) |
| 78 | w_mesh_3 = np.load(os.path.join( |
| 79 | self.data_dir, "w_mesh_3.npy"), allow_pickle=True) |
| 80 | self.w_mesh = list(w_mesh_0) + list(w_mesh_1) + \ |
| 81 | list(w_mesh_2) + list(w_mesh_3) |
| 82 | |
| 83 | def __len__(self): |
| 84 | return len(self.ids) * self.k |
nothing calls this directly
no outgoing calls
no test coverage detected