diff --git a/smpl/smpl_torch.py b/smpl/smpl_torch.py index 16e1855..d827c48 100644 --- a/smpl/smpl_torch.py +++ b/smpl/smpl_torch.py @@ -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])]) rest_shape_h = torch.cat( @@ -214,11 +214,18 @@ class SMPL(Module): v = torch.reshape(v, (batch_num, -1, 4))[:, :, :3] result = v - root_joint = torch.reshape(joints[:,0,:], (-1, 1, 3)) - result = result - root_joint - joints = joints - root_joint + # root_joint = torch.reshape(joints[:,0,:], (-1, 1, 3)) + # result = result - 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: result = result[:,self.to_keep,:] - return result, joints + return result, None # joints