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

Method __init__

detrsmpl/models/heads/expose_head.py:383–419  ·  view source on GitHub ↗
(self,
                 init_cfg=None,
                 num_betas: int = 10,
                 mean_pose_path: str = '',
                 pose_param_conf: list = None,
                 input_feat_dim: int = 2048,
                 regressor_cfg: dict = None,
                 camera_cfg: dict = None)

Source from the content-addressed store, hash-verified

381class ExPoseHandHead(ExPoseHead):
382 """Head for ExPose Hand Model."""
383 def __init__(self,
384 init_cfg=None,
385 num_betas: int = 10,
386 mean_pose_path: str = '',
387 pose_param_conf: list = None,
388 input_feat_dim: int = 2048,
389 regressor_cfg: dict = None,
390 camera_cfg: dict = None):
391 super().__init__(init_cfg)
392 self.num_betas = num_betas
393 # poses
394 self.pose_param_conf = pose_param_conf
395 mean_poses_dict = {}
396 if os.path.exists(mean_pose_path):
397 with open(mean_pose_path, 'rb') as f:
398 mean_poses_dict = pickle.load(f)
399 start, mean_lst = self.load_param_decoder(mean_poses_dict)
400
401 shape_mean = torch.zeros([num_betas], dtype=torch.float32)
402 shape_idxs = list(range(start, start + num_betas))
403 self.register_buffer('shape_idxs',
404 torch.tensor(shape_idxs, dtype=torch.long))
405 start += num_betas
406 mean_lst.append(shape_mean.view(-1))
407
408 # camera
409 mean, dim, scale_func = self.get_camera_param(camera_cfg)
410 self.camera_scale_func = scale_func
411 camera_idxs = list(range(start, start + dim))
412 self.register_buffer('camera_idxs',
413 torch.tensor(camera_idxs, dtype=torch.long))
414 start += dim
415 mean_lst.append(mean)
416
417 param_mean = torch.cat(mean_lst).view(1, -1)
418 self.load_regressor(input_feat_dim, param_mean, regressor_cfg)
419 self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
420
421 def forward(self, features, cond=None):
422 """Forward function of ExPose Hand Head.

Callers

nothing calls this directly

Calls 5

load_param_decoderMethod · 0.80
get_camera_paramMethod · 0.80
load_regressorMethod · 0.80
__init__Method · 0.45
loadMethod · 0.45

Tested by

no test coverage detected