MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / dict2tensor

Method dict2tensor

detrsmpl/models/body_models/smpl.py:184–200  ·  view source on GitHub ↗

Convert smpl pose dict to full pose tensor. Args: smpl_dict (dict): smpl pose dict. Returns: torch: full pose tensor.

(cls, smpl_dict: dict)

Source from the content-addressed store, hash-verified

182
183 @classmethod
184 def dict2tensor(cls, smpl_dict: dict) -> torch.Tensor:
185 """Convert smpl pose dict to full pose tensor.
186
187 Args:
188 smpl_dict (dict): smpl pose dict.
189
190 Returns:
191 torch: full pose tensor.
192 """
193 assert cls.body_pose_keys.issubset(smpl_dict)
194 for k in smpl_dict:
195 if isinstance(smpl_dict[k], np.ndarray):
196 smpl_dict[k] = torch.Tensor(smpl_dict[k])
197 global_orient = smpl_dict['global_orient'].view(-1, 3)
198 body_pose = smpl_dict['body_pose'].view(-1, 3 * cls.NUM_BODY_JOINTS)
199 full_pose = torch.cat([global_orient, body_pose], dim=1)
200 return full_pose
201
202
203class GenderedSMPL(torch.nn.Module):

Callers 2

_prepare_meshFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected