dataset/view bugfix

This commit is contained in:
2023-01-14 18:42:27 +00:00
parent 581a5b2af2
commit 7dffb02286
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -69,6 +69,7 @@ class Dataset(Dataset):
# body = readPC2Frame(os.path.join(path, 'Body_posed.pc16'), frame.frame_nr, True) # body = readPC2Frame(os.path.join(path, 'Body_posed.pc16'), frame.frame_nr, True)
body, body_faces, root_joint, joints, joints_no_trans = self.reader.read_human(frame.id, frame.frame_nr, trans, zrot) body, body_faces, root_joint, joints, joints_no_trans = self.reader.read_human(frame.id, frame.frame_nr, trans, zrot)
# body_no_trans, _, _, _, _ = self.reader.read_human(frame.id, frame.frame_nr, absolute=False) # body_no_trans, _, _, _, _ = self.reader.read_human(frame.id, frame.frame_nr, absolute=False)
body = torch.tensor(body.astype(np.float32), device=self.device)
body_faces = quads2tris(body_faces) body_faces = quads2tris(body_faces)
if self.random_view: if self.random_view:
@@ -81,9 +82,9 @@ class Dataset(Dataset):
mesh_posed = transform.transform_points(mesh_posed) mesh_posed = transform.transform_points(mesh_posed)
body = transform.transform_points(body) body = transform.transform_points(body)
else: else:
view = torch.eye(3) view = torch.eye(3, device=self.device)
combined = torch.Tensor(np.concatenate((body, mesh_posed[mesh_mask, :]))).to(self.device) combined = torch.concat((body, mesh_posed[mesh_mask, :]))
# combined_no_trans = torch.Tensor(np.concatenate((body_no_trans, mesh_posed_no_trans[mesh_mask, :]))).to('cuda') # combined_no_trans = torch.Tensor(np.concatenate((body_no_trans, mesh_posed_no_trans[mesh_mask, :]))).to('cuda')
combined_faces = torch.Tensor(np.concatenate((body_faces, faces + body.shape[0]))).to(self.device) combined_faces = torch.Tensor(np.concatenate((body_faces, faces + body.shape[0]))).to(self.device)
+3 -1
View File
@@ -13,6 +13,7 @@ class ViewEncoder(nn.Module):
super().__init__() super().__init__()
self.features: int = features self.features: int = features
self.flatten = nn.Flatten()
self.lin1 = nn.LazyLinear(features).to(device) self.lin1 = nn.LazyLinear(features).to(device)
self.act1 = nn.GELU().to(device) self.act1 = nn.GELU().to(device)
self.lin2 = nn.Linear(features, features * 15 * 20).to(device) self.lin2 = nn.Linear(features, features * 15 * 20).to(device)
@@ -20,7 +21,8 @@ class ViewEncoder(nn.Module):
def forward(self, input: torch.Tensor) -> torch.Tensor: def forward(self, input: torch.Tensor) -> torch.Tensor:
x: torch.Tensor = self.lin1(input) x: torch.Tensor = self.flatten(input)
x= self.lin1(x)
x = self.act1(x) x = self.act1(x)
x = self.lin2(x) x = self.lin2(x)
x = self.act2(x) x = self.act2(x)