ahmedosman / STAR

ECCV2020 - Official code repository for the paper : STAR - A Sparse Trained Articulated Human Body Regressor
https://star.is.tue.mpg.de
Other
654 stars 95 forks source link

what does "v" mean and how to get joints coordinates #14

Closed special-yang closed 3 years ago

special-yang commented 3 years ago

v = torch.matmul(T, rest_shape_h[:, :, :, None])[:, :, :3, 0] v = v + trans[:,None,:] v.f = self.f v.v_posed = v_posed v.v_shaped = v_shaped

v is a tensor v.f???a

special-yang commented 3 years ago

J = torch.einsum('bik,ji->bjk', [v_shaped, self.J_regressor]) J is the joint coordinates?

totomobile43 commented 3 years ago

We also just ran into this issue. Following the example from human body prior (https://github.com/nghorbani/human_body_prior/blob/1936f38aec4bb959f6a8bf4ed304b6aafb42fa30/human_body_prior/body_model/lbs.py#L104), you can transform the joints using this code:

from human_body_prior.body_model.lbs import batch_rigid_transform
...
J_transformed, A = batch_rigid_transform(R.contiguous(), J.contiguous(),  self.kintree_table[0].long())
 J_transformed += trans.unsqueeze(dim=1)

Credit to @kaufManu for the solution.

special-yang commented 3 years ago

We also just ran into this issue. Following the example from human body prior (https://github.com/nghorbani/human_body_prior/blob/1936f38aec4bb959f6a8bf4ed304b6aafb42fa30/human_body_prior/body_model/lbs.py#L104), you can transform the joints using this code:

from human_body_prior.body_model.lbs import batch_rigid_transform
...
J_transformed, A = batch_rigid_transform(R.contiguous(), J.contiguous(),  self.kintree_table[0].long())
 J_transformed += trans.unsqueeze(dim=1)

Credit to @kaufManu for the solution.

STAR/pytorch/star.py / line 90 J = torch.einsum('bik,ji->bjk', [v_shaped, self.J_regressor]) Is J the coordinate of the joint point in the world coordinate system? and Where is the zero point of the world coordinate system

totomobile43 commented 3 years ago

J is in local coordinates. This is why we apply a rotation then a translation. The center of SMPL/STAR is at (0,0,0) which is in the center of the mesh and near the root node but not quite on top.

ahmedosman commented 3 years ago

That's missing from the torch module of STAR, I'll commit it shortly.

special-yang commented 3 years ago

J is in local coordinates. This is why we apply a rotation then a translation. The center of SMPL/STAR is at (0,0,0) which is in the center of the mesh and near the root node but not quite on top.

Thank for your help, from human_body_prior.body_model.lbs import batch_rigid_transform ... J_transformed, A = batch_rigid_transform(R.contiguous(), J.contiguous(), self.kintree_table[0].long()) J_transformed += trans.unsqueeze(dim=1)

(1) Apply a translation "J_transformed += trans.unsqueeze(dim=1)" is to get the location in Camera coordinate system?

ahmedosman commented 3 years ago

Hi @ysp568 , this line is to get the model posed joints in the world coordinate. I added the model posed joints for the torch module line 144-152 https://github.com/ahmedosman/STAR/blob/master/star/pytorch/star.py you can simply get the 24 posed joints by star.J_transformed

I am going to close this issue now.