| 34 | |
| 35 | |
| 36 | class SMPL(nn.Module): |
| 37 | |
| 38 | NUM_JOINTS = 23 |
| 39 | NUM_BODY_JOINTS = 23 |
| 40 | SHAPE_SPACE_DIM = 300 |
| 41 | |
| 42 | def __init__(self, |
| 43 | model_path: str, |
| 44 | data_struct: Optional[Struct] = None, |
| 45 | create_betas: bool = True, |
| 46 | betas: Optional[Tensor] = None, |
| 47 | num_betas: int = 10, |
| 48 | create_global_orient: bool = True, |
| 49 | global_orient: Optional[Tensor] = None, |
| 50 | create_body_pose: bool = True, |
| 51 | body_pose: Optional[Tensor] = None, |
| 52 | create_transl: bool = True, |
| 53 | transl: Optional[Tensor] = None, |
| 54 | dtype=torch.float32, |
| 55 | batch_size: int = 1, |
| 56 | joint_mapper=None, |
| 57 | gender: str = 'neutral', |
| 58 | vertex_ids: Dict[str, int] = None, |
| 59 | v_template: Optional[Union[Tensor, Array]] = None, |
| 60 | **kwargs) -> None: |
| 61 | """SMPL model constructor. |
| 62 | |
| 63 | Parameters |
| 64 | ---------- |
| 65 | model_path: str |
| 66 | The path to the folder or to the file where the model |
| 67 | parameters are stored |
| 68 | data_struct: Strct |
| 69 | A struct object. If given, then the parameters of the model are |
| 70 | read from the object. Otherwise, the model tries to read the |
| 71 | parameters from the given `model_path`. (default = None) |
| 72 | create_global_orient: bool, optional |
| 73 | Flag for creating a member variable for the global orientation |
| 74 | of the body. (default = True) |
| 75 | global_orient: torch.tensor, optional, Bx3 |
| 76 | The default value for the global orientation variable. |
| 77 | (default = None) |
| 78 | create_body_pose: bool, optional |
| 79 | Flag for creating a member variable for the pose of the body. |
| 80 | (default = True) |
| 81 | body_pose: torch.tensor, optional, Bx(Body Joints * 3) |
| 82 | The default value for the body pose variable. |
| 83 | (default = None) |
| 84 | num_betas: int, optional |
| 85 | Number of shape components to use |
| 86 | (default = 10). |
| 87 | create_betas: bool, optional |
| 88 | Flag for creating a member variable for the shape space |
| 89 | (default = True). |
| 90 | betas: torch.tensor, optional, Bx10 |
| 91 | The default value for the shape member variable. |
| 92 | (default = None) |
| 93 | create_transl: bool, optional |