temporarily remove joints because not working

This commit is contained in:
2023-05-21 09:59:09 +00:00
parent 6a710d6f36
commit 391e7f120b
+12 -5
View File
@@ -204,7 +204,7 @@ 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])]) 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])])
rest_shape_h = torch.cat( rest_shape_h = torch.cat(
@@ -214,11 +214,18 @@ class SMPL(Module):
v = torch.reshape(v, (batch_num, -1, 4))[:, :, :3] v = torch.reshape(v, (batch_num, -1, 4))[:, :, :3]
result = v result = v
root_joint = torch.reshape(joints[:,0,:], (-1, 1, 3)) # root_joint = torch.reshape(joints[:,0,:], (-1, 1, 3))
result = result - root_joint # result = result - root_joint
joints = joints - root_joint # joints = joints - root_joint
# # plut result as a plotly 3d mesh
# import plotly.graph_objects as go
# fig = go.Figure(data=[go.Mesh3d(x=result[0,:,0].cpu().numpy(), y=result[0,:,2].cpu().numpy(), z=result[0,:,1].cpu().numpy(), color='lightpink', opacity=0.50, i=self.f[:,0], j=self.f[:,1], k=self.f[:,2], name='body')])
# # plot the joints as spheres
# fig.add_trace(go.Scatter3d(x=joints[0,:,0].cpu().numpy(), y=joints[0,:,2].cpu().numpy(), z=joints[0,:,1].cpu().numpy(), mode='markers', marker=dict(size=5, color='red'), name='joints'))
# fig.show()
if remove and verts is None: if remove and verts is None:
result = result[:,self.to_keep,:] result = result[:,self.to_keep,:]
return result, joints return result, None # joints