add BG processing BG_actor4

This commit is contained in:
sen.liang committed 2022-04-27 12:04:26 +08:00
1 parent 7550ffe30f
commit 6e0e400449
12 files changed
+844 -241

No files matched your search

+10 -1
View File
@@ -56,9 +56,17 @@ class Audio2MeshModel(Base):
# get template
self.temp_verts, self.temp_ldmk2d, self.temp_ldmk3d \
= self.get_template_vertices() # verts: (1 x 1 x 5023 x 3), ldmk: (1 x 1 x 68 x 3)
self.temp_verts_specific, self.temp_ldmk2d_specific, self.temp_ldmk3d_specific \
= self.get_template_vertices(self.mean_dict) # verts: (1 x 1 x 5023 x 3), ldmk: (1 x 1 x 68 x 3)
# self.temp_verts_specific = np.load("/ssdata1/lsen/CODE/audio-to-motion/data/Actor4/template_meiyan2.npy") # (5023, 3)
# self.temp_verts_specific = self.temp_verts_specific.reshape(1, 1, 5023, 3)
# self.temp_verts_specific = torch.from_numpy(self.temp_verts_specific).to(self.device)
# save to
# loss function
self.loss_func_wing = WingLoss(reduction="none") # return (B, )
self.loss_func_l1 = nn.L1Loss(reduction="none")
@@ -270,7 +278,7 @@ class Audio2MeshModel(Base):
batch_shape = torch.zeros(1, 100).to(self.device)
with torch.no_grad():
# verts = 1 x 5023 x 3, ldmk2d=1 x 68 x 3, ldmk3d=1 x 68 x 3
# verts = 1 x 5023 x 3, ldmk2d=1 x 68 x 3, ldmk3d=1 x 68 x 3
verts, ldmk2d, ldmk3d = self.netF(batch_shape, batch_exp, batch_pose)
verts = verts.reshape(1, 1, -1, 3) # 1 x 1 x 5023 x 3
ldmk2d = ldmk2d.reshape(1, 1, -1, 3) # 1 x 1 x 68 x 3
@@ -278,6 +286,7 @@ class Audio2MeshModel(Base):
print(f"template verts reshape = {verts.shape}")
return verts, ldmk2d, ldmk3d