additional smpl files

This commit is contained in:
2023-05-09 11:17:52 +00:00
parent 4081496c24
commit 07facfe064
3 changed files with 7 additions and 2 deletions
BIN
View File
Binary file not shown.
+7 -2
View File
@@ -50,6 +50,10 @@ class SMPL(Module):
self.f_skirt = np.array(F['faces_skirt']) self.f_skirt = np.array(F['faces_skirt'])
self.nn = np.array(sio.loadmat(os.path.join(path, 'NN.mat'))) self.nn = np.array(sio.loadmat(os.path.join(path, 'NN.mat')))
self.to_keep = sio.loadmat(os.path.join(path, 'keep_remove.mat'))['keep'].reshape(-1) self.to_keep = sio.loadmat(os.path.join(path, 'keep_remove.mat'))['keep'].reshape(-1)
self.f_all = np.asarray(female['f'])
# convert quad faces to triangles
self.f_all = np.concatenate([self.f_all[:,:3], self.f_all[:,[0,2,3]]], axis=0)
self.weights_all = self.weights self.weights_all = self.weights
self.weights = self.weights[:,self.to_keep,:] self.weights = self.weights[:,self.to_keep,:]
@@ -205,8 +209,9 @@ class SMPL(Module):
) )
joints = torch.matmul(results, torch.transpose(torch.concat([J, torch.ones((J.shape[0], 24, 1), dtype=torch.float32, device=J.get_device())], axis=-1)[:,:,None,:],2,3))[:,:,:3,0] joints = torch.matmul(results, torch.transpose(torch.concat([J, torch.ones((J.shape[0], 24, 1), dtype=torch.float32, device=J.get_device())], axis=-1)[:,:,None,:],2,3))[:,:,:3,0]
T = torch.stack([torch.tensordot(results[i], self.weights[g.to(torch.long)], dims=([0], [1])).permute(2, 0, 1) for i, g in enumerate(betas[:,-1])]) weights = self.weights if remove else self.weights_all
T = torch.stack([torch.tensordot(results[i], weights[g.to(torch.long)], dims=([0], [1])).permute(2, 0, 1) for i, g in enumerate(betas[:,-1])])
rest_shape_h = torch.cat( rest_shape_h = torch.cat(
(v_posed, torch.ones((batch_num, v_posed.shape[1], 1), dtype=torch.float32).to(self.device)), dim=2 (v_posed, torch.ones((batch_num, v_posed.shape[1], 1), dtype=torch.float32).to(self.device)), dim=2
) )
Binary file not shown.