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

Method __init__

util/smplx/smplx/body_models.py:1409–1537  ·  view source on GitHub ↗

MANO model constructor. Parameters ---------- model_path: str The path to the folder or to the file where the model parameters are stored data_struct: Strct A struct object. If given, then the parameters of the model are

(self,
                 model_path: str,
                 is_rhand: bool = True,
                 data_struct: Optional[Struct] = None,
                 create_hand_pose: bool = True,
                 hand_pose: Optional[Tensor] = None,
                 use_pca: bool = True,
                 num_pca_comps: int = 6,
                 flat_hand_mean: bool = False,
                 batch_size: int = 1,
                 dtype=torch.float32,
                 vertex_ids=None,
                 use_compressed: bool = True,
                 ext: str = 'pkl',
                 **kwargs)

Source from the content-addressed store, hash-verified

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
1461 if osp.isdir(model_path):
1462 model_fn = 'MANO_{}.{ext}'.format(
1463 'RIGHT' if is_rhand else 'LEFT', ext=ext)
1464 mano_path = os.path.join(model_path, model_fn)
1465 else:
1466 mano_path = model_path

Callers

nothing calls this directly

Calls 8

create_mean_poseMethod · 0.95
StructClass · 0.85
cloneMethod · 0.80
to_tensorFunction · 0.70
loadMethod · 0.45
__init__Method · 0.45
valuesMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected