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

Method __init__

util/smplx/smplx/vertex_joint_selector.py:28–67  ·  view source on GitHub ↗
(self,
                 vertex_ids=None,
                 use_hands=True,
                 use_feet_keypoints=True,
                 **kwargs)

Source from the content-addressed store, hash-verified

26
27class VertexJointSelector(nn.Module):
28 def __init__(self,
29 vertex_ids=None,
30 use_hands=True,
31 use_feet_keypoints=True,
32 **kwargs):
33 super(VertexJointSelector, self).__init__()
34
35 extra_joints_idxs = []
36
37 face_keyp_idxs = np.array([
38 vertex_ids['nose'], vertex_ids['reye'], vertex_ids['leye'],
39 vertex_ids['rear'], vertex_ids['lear']
40 ],
41 dtype=np.int64)
42
43 extra_joints_idxs = np.concatenate([extra_joints_idxs, face_keyp_idxs])
44
45 if use_feet_keypoints:
46 feet_keyp_idxs = np.array([
47 vertex_ids['LBigToe'], vertex_ids['LSmallToe'],
48 vertex_ids['LHeel'], vertex_ids['RBigToe'],
49 vertex_ids['RSmallToe'], vertex_ids['RHeel']
50 ],
51 dtype=np.int32)
52
53 extra_joints_idxs = np.concatenate(
54 [extra_joints_idxs, feet_keyp_idxs])
55
56 if use_hands:
57 self.tip_names = ['thumb', 'index', 'middle', 'ring', 'pinky']
58
59 tips_idxs = []
60 for hand_id in ['l', 'r']:
61 for tip_name in self.tip_names:
62 tips_idxs.append(vertex_ids[hand_id + tip_name])
63
64 extra_joints_idxs = np.concatenate([extra_joints_idxs, tips_idxs])
65
66 self.register_buffer('extra_joints_idxs',
67 to_tensor(extra_joints_idxs, dtype=torch.long))
68
69 def forward(self, vertices, joints):
70 extra_joints = torch.index_select(vertices, 1, self.extra_joints_idxs)

Callers

nothing calls this directly

Calls 2

concatenateMethod · 0.80
to_tensorFunction · 0.70

Tested by

no test coverage detected