pixelite1201 / BEDLAM

206 stars 19 forks source link

What is the different between smplx.create() and SMPLX() in train.models.head.smplx_local? #16

Closed puckikk1202 closed 10 months ago

puckikk1202 commented 11 months ago

Hi,

Thanks for your great work! I have noticed that the input body_pose.shape in smplx.create() should be in the shape of(-1, 21, 3), but the one for SMPLX() in train.models.head.smplx_local should be (-1, 21, 3, 3). I am wondering what is the extract 3 dimension in the hmr_output['pred_pose'] compared to the others. Also if I want to use smplx.create() to generate the model, how should I transpose the (-1, 21, 3, 3) shape hmr_output['pred_pose'] ?

model = smplx.create(model_path='./data/body_models/smplx/models', gender='neutral', model_type='smplx', num_betas=11, ext='npz')
pose = smpl['pred_pose'][:,1:22]
output = model(betas=smpl['pred_shape'].detach().cpu(), body_pose=pose.detach().cpu().contiguous(), return_verts=True)

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 3 for tensor number 1 in the list.

And it worked when I used SMPLX in smplx_local

from train.models.head.smplx_local import SMPLX

model = SMPLX(model_path='./data/body_models/smplx/models/smplx', gender='neutral', model_type='smplx', num_betas=11, ext='npz')

Looking forward to your reply, thank you!

pixelite1201 commented 10 months ago

Hello,

Those are pose parameters in different format 21x3x3 is rotation matrix format while 21x3 is axis-angle format. You can convert between two using various function described https://github.com/pixelite1201/BEDLAM/blob/master/train/utils/geometry.py. e.g. batch_rot2aa convert from rotation matrix to axis angle format.