diff --git a/superSMPL/NN.mat b/superSMPL/NN.mat new file mode 100644 index 0000000..f2e3ac2 Binary files /dev/null and b/superSMPL/NN.mat differ diff --git a/superSMPL/smpl_torch.py b/superSMPL/smpl_torch.py index 4c0226f..5737dd8 100755 --- a/superSMPL/smpl_torch.py +++ b/superSMPL/smpl_torch.py @@ -50,6 +50,10 @@ class SMPL(Module): self.f_skirt = np.array(F['faces_skirt']) 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.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 = 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] - - 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( (v_posed, torch.ones((batch_num, v_posed.shape[1], 1), dtype=torch.float32).to(self.device)), dim=2 ) diff --git a/superSMPL/ssmpl_faces.mat b/superSMPL/ssmpl_faces.mat new file mode 100644 index 0000000..bbf7c78 Binary files /dev/null and b/superSMPL/ssmpl_faces.mat differ