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

Method forward

util/smplx/smplx/body_models.py:277–364  ·  view source on GitHub ↗

Forward pass for the SMPL model. Parameters ---------- global_orient: torch.tensor, optional, shape Bx3 If given, ignore the member variable and use it as the global rotation of the body. Useful if someone wishes to predicts this with an e

(self,
                betas: Optional[Tensor] = None,
                body_pose: Optional[Tensor] = None,
                global_orient: Optional[Tensor] = None,
                transl: Optional[Tensor] = None,
                return_verts=True,
                return_full_pose: bool = False,
                pose2rot: bool = True,
                **kwargs)

Source from the content-addressed store, hash-verified

275 return '\n'.join(msg)
276
277 def forward(self,
278 betas: Optional[Tensor] = None,
279 body_pose: Optional[Tensor] = None,
280 global_orient: Optional[Tensor] = None,
281 transl: Optional[Tensor] = None,
282 return_verts=True,
283 return_full_pose: bool = False,
284 pose2rot: bool = True,
285 **kwargs) -> SMPLOutput:
286 """Forward pass for the SMPL model.
287
288 Parameters
289 ----------
290 global_orient: torch.tensor, optional, shape Bx3
291 If given, ignore the member variable and use it as the global
292 rotation of the body. Useful if someone wishes to predicts this
293 with an external model. (default=None)
294 betas: torch.tensor, optional, shape Bx10
295 If given, ignore the member variable `betas` and use it
296 instead. For example, it can used if shape parameters
297 `betas` are predicted from some external model.
298 (default=None)
299 body_pose: torch.tensor, optional, shape Bx(J*3)
300 If given, ignore the member variable `body_pose` and use it
301 instead. For example, it can used if someone predicts the
302 pose of the body joints are predicted from some external model.
303 It should be a tensor that contains joint rotations in
304 axis-angle format. (default=None)
305 transl: torch.tensor, optional, shape Bx3
306 If given, ignore the member variable `transl` and use it
307 instead. For example, it can used if the translation
308 `transl` is predicted from some external model.
309 (default=None)
310 return_verts: bool, optional
311 Return the vertices. (default=True)
312 return_full_pose: bool, optional
313 Returns the full axis-angle pose vector (default=False)
314
315 Returns
316 -------
317 """
318 # If no shape and pose parameters are passed along, then use the
319 # ones from the module
320 global_orient = (global_orient
321 if global_orient is not None else self.global_orient)
322 body_pose = body_pose if body_pose is not None else self.body_pose
323 betas = betas if betas is not None else self.betas
324
325 apply_trans = transl is not None or hasattr(self, 'transl')
326 if transl is None and hasattr(self, 'transl'):
327 transl = self.transl
328
329 full_pose = torch.cat([global_orient, body_pose], dim=1)
330
331 batch_size = max(betas.shape[0], global_orient.shape[0],
332 body_pose.shape[0])
333
334 if betas.shape[0] != batch_size:

Callers

nothing calls this directly

Calls 2

lbsFunction · 0.90
SMPLOutputClass · 0.85

Tested by

no test coverage detected