| 1401 | |
| 1402 | |
| 1403 | class MANO(SMPL): |
| 1404 | # The hand joints are replaced by MANO |
| 1405 | NUM_BODY_JOINTS = 1 |
| 1406 | NUM_HAND_JOINTS = 15 |
| 1407 | NUM_JOINTS = NUM_BODY_JOINTS + NUM_HAND_JOINTS |
| 1408 | |
| 1409 | def __init__(self, |
| 1410 | model_path: str, |
| 1411 | is_rhand: bool = True, |
| 1412 | data_struct: Optional[Struct] = None, |
| 1413 | create_hand_pose: bool = True, |
| 1414 | hand_pose: Optional[Tensor] = None, |
| 1415 | use_pca: bool = True, |
| 1416 | num_pca_comps: int = 6, |
| 1417 | flat_hand_mean: bool = False, |
| 1418 | batch_size: int = 1, |
| 1419 | dtype=torch.float32, |
| 1420 | vertex_ids=None, |
| 1421 | use_compressed: bool = True, |
| 1422 | ext: str = 'pkl', |
| 1423 | **kwargs) -> None: |
| 1424 | """MANO model constructor. |
| 1425 | |
| 1426 | Parameters |
| 1427 | ---------- |
| 1428 | model_path: str |
| 1429 | The path to the folder or to the file where the model |
| 1430 | parameters are stored |
| 1431 | data_struct: Strct |
| 1432 | A struct object. If given, then the parameters of the model are |
| 1433 | read from the object. Otherwise, the model tries to read the |
| 1434 | parameters from the given `model_path`. (default = None) |
| 1435 | create_hand_pose: bool, optional |
| 1436 | Flag for creating a member variable for the pose of the right |
| 1437 | hand. (default = True) |
| 1438 | hand_pose: torch.tensor, optional, BxP |
| 1439 | The default value for the right hand pose member variable. |
| 1440 | (default = None) |
| 1441 | num_pca_comps: int, optional |
| 1442 | The number of PCA components to use for each hand. |
| 1443 | (default = 6) |
| 1444 | flat_hand_mean: bool, optional |
| 1445 | If False, then the pose of the hand is initialized to False. |
| 1446 | batch_size: int, optional |
| 1447 | The batch size used for creating the member variables |
| 1448 | dtype: torch.dtype, optional |
| 1449 | The data type for the created variables |
| 1450 | vertex_ids: dict, optional |
| 1451 | A dictionary containing the indices of the extra vertices that |
| 1452 | will be selected |
| 1453 | """ |
| 1454 | |
| 1455 | self.num_pca_comps = num_pca_comps |
| 1456 | self.is_rhand = is_rhand |
| 1457 | # If no data structure is passed, then load the data from the given |
| 1458 | # model folder |
| 1459 | if data_struct is None: |
| 1460 | # Load the model |