Adding Pose to the clothed SMPL-X Model
hshreeshail opened this issue · 2 comments
How do I add pose to the clothed SMPL-X model?
I tried to do this the following way, but did not succeed.
I see that that the inferer.make_rotation_images()
function calls the load_smplx()
function, in which the SMPLX model along with its mesh vertices (in the variable smpl_output.vertices
are obtained.
The SMPLX model has the following variable attributes
vertices <class 'torch.Tensor'>, torch.Size([1, 10475, 3])
joints <class 'torch.Tensor'>, torch.Size([1, 127, 3])
full_pose <class 'NoneType'>,
global_orient <class 'torch.Tensor'>, torch.Size([1, 3])
transl <class 'NoneType'>,
betas <class 'torch.Tensor'>, torch.Size([1, 10])
body_pose <class 'torch.Tensor'>, torch.Size([1, 63])
left_hand_pose <class 'torch.Tensor'>, torch.Size([1, 45])
right_hand_pose <class 'torch.Tensor'>, torch.Size([1, 45])
expression <class 'torch.nn.parameter.Parameter'>, torch.Size([1, 10])
jaw_pose <class 'torch.Tensor'>, torch.Size([1, 3])
I tried assigning values to body_pose
, left_hand_pose
, and right_hand_pose
. However, this does not modify smpl_output.vertices
, and consequently, the generated output images are not modified.
I see that pose information from a different person can be transferred to a clothed avatar as shown in Fig.4 in the paper. I just wanted to know how to do it in this repo.
Figured out one way to do it:
load_smplx()
gets an object instance of SMPLXOutput
class in the smpl_output
variable. The inference of mesh vertices from the pose/shape parameters happens inside the forward function of the class, and hence, modifying pose/shape parameters once the object has been returned will not modify the vertices
attribute.
To the body_models.py
file from the smplx
package (path should be something like /path_to_env/lib/python3.7/site-packages/smplx/body_models.py
), I added the logic to set body_pose, left_hand_pose, right_hand_pose
by reading these values from an external file.
I added these lines before the line full_pose = torch.cat([global_orient, ... , right_hand_pose], dim=1)
in the forward function.