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

Method __call__

detrsmpl/models/registrants/smplify.py:157–275  ·  view source on GitHub ↗

Run registration. Notes: B: batch size K: number of keypoints D: shape dimension Provide only keypoints2d or keypoints3d, not both. Args: keypoints2d: 2D keypoints of shape (B, K, 2) keypoints2d_conf: 2D keypoi

(self,
                 keypoints2d: torch.Tensor = None,
                 keypoints2d_conf: torch.Tensor = None,
                 keypoints3d: torch.Tensor = None,
                 keypoints3d_conf: torch.Tensor = None,
                 init_global_orient: torch.Tensor = None,
                 init_transl: torch.Tensor = None,
                 init_body_pose: torch.Tensor = None,
                 init_betas: torch.Tensor = None,
                 return_verts: bool = False,
                 return_joints: bool = False,
                 return_full_pose: bool = False,
                 return_losses: bool = False)

Source from the content-addressed store, hash-verified

155 self._set_keypoint_idxs()
156
157 def __call__(self,
158 keypoints2d: torch.Tensor = None,
159 keypoints2d_conf: torch.Tensor = None,
160 keypoints3d: torch.Tensor = None,
161 keypoints3d_conf: torch.Tensor = None,
162 init_global_orient: torch.Tensor = None,
163 init_transl: torch.Tensor = None,
164 init_body_pose: torch.Tensor = None,
165 init_betas: torch.Tensor = None,
166 return_verts: bool = False,
167 return_joints: bool = False,
168 return_full_pose: bool = False,
169 return_losses: bool = False) -> dict:
170 """Run registration.
171
172 Notes:
173 B: batch size
174 K: number of keypoints
175 D: shape dimension
176 Provide only keypoints2d or keypoints3d, not both.
177
178 Args:
179 keypoints2d: 2D keypoints of shape (B, K, 2)
180 keypoints2d_conf: 2D keypoint confidence of shape (B, K)
181 keypoints3d: 3D keypoints of shape (B, K, 3).
182 keypoints3d_conf: 3D keypoint confidence of shape (B, K)
183 init_global_orient: initial global_orient of shape (B, 3)
184 init_transl: initial transl of shape (B, 3)
185 init_body_pose: initial body_pose of shape (B, 69)
186 init_betas: initial betas of shape (B, D)
187 return_verts: whether to return vertices
188 return_joints: whether to return joints
189 return_full_pose: whether to return full pose
190 return_losses: whether to return loss dict
191
192 Returns:
193 ret: a dictionary that includes body model parameters,
194 and optional attributes such as vertices and joints
195 """
196 assert keypoints2d is not None or keypoints3d is not None, \
197 'Neither of 2D nor 3D keypoints are provided.'
198 assert not (keypoints2d is not None and keypoints3d is not None), \
199 'Do not provide both 2D and 3D keypoints.'
200 batch_size = keypoints2d.shape[0] if keypoints2d is not None \
201 else keypoints3d.shape[0]
202
203 global_orient = self._match_init_batch_size(
204 init_global_orient, self.body_model.global_orient, batch_size)
205 transl = self._match_init_batch_size(init_transl,
206 self.body_model.transl,
207 batch_size)
208 body_pose = self._match_init_batch_size(init_body_pose,
209 self.body_model.body_pose,
210 batch_size)
211 if init_betas is None and self.use_one_betas_per_video:
212 betas = torch.zeros(1, self.body_model.betas.shape[-1]).to(
213 self.device)
214 else:

Callers

nothing calls this directly

Calls 9

_optimize_stageMethod · 0.95
evaluateMethod · 0.95
cloneMethod · 0.80
printFunction · 0.50
toMethod · 0.45
keysMethod · 0.45
itemsMethod · 0.45
detachMethod · 0.45

Tested by

no test coverage detected