Builds the initial point for the iterative regressor of the hand.
(self, global_orient, body_pose, betas, left_hand_pose,
raw_right_hand_pose, batch_size)
| 379 | self.condition_hand_finger_pose = condition_hand_finger_pose |
| 380 | |
| 381 | def build_hand_mean(self, global_orient, body_pose, betas, left_hand_pose, |
| 382 | raw_right_hand_pose, batch_size): |
| 383 | """Builds the initial point for the iterative regressor of the hand.""" |
| 384 | hand_mean = [] |
| 385 | |
| 386 | # if self.condition_hand_on_body: |
| 387 | # Convert the absolute pose to the latent representation |
| 388 | if self.condition_hand_wrist_pose: |
| 389 | # Compute the absolute pose of the right wrist |
| 390 | right_wrist_pose_abs = find_joint_global_rotation( |
| 391 | self.right_wrist_kin_chain, global_orient, body_pose) |
| 392 | right_wrist_pose = right_wrist_pose_abs[:, :3, :2].contiguous( |
| 393 | ).reshape(batch_size, -1) |
| 394 | |
| 395 | # Compute the absolute rotation for the left wrist |
| 396 | left_wrist_pose_abs = find_joint_global_rotation( |
| 397 | self.left_wrist_kin_chain, global_orient, body_pose) |
| 398 | # Flip the left wrist to the right |
| 399 | left_to_right_wrist_pose = flip_rotmat(left_wrist_pose_abs) |
| 400 | |
| 401 | # Convert to the latent representation |
| 402 | left_to_right_wrist_pose = left_to_right_wrist_pose[:, :3, : |
| 403 | 2].contiguous( |
| 404 | ).reshape( |
| 405 | batch_size, |
| 406 | -1) |
| 407 | else: |
| 408 | right_wrist_pose = self.model_head.get_mean('global_orient', |
| 409 | batch_size=batch_size) |
| 410 | left_to_right_wrist_pose = self.model_head.get_mean( |
| 411 | 'global_orient', batch_size=batch_size) |
| 412 | |
| 413 | # Convert the pose of the left hand to the right hand and project |
| 414 | # it to the encoder space |
| 415 | left_to_right_hand_pose = flip_rotmat( |
| 416 | left_hand_pose)[:, :, :3, :2].contiguous().reshape(batch_size, -1) |
| 417 | right_hand_pose = raw_right_hand_pose.reshape(batch_size, -1) |
| 418 | camera_mean = self.model_head.get_mean('camera', batch_size=batch_size) |
| 419 | |
| 420 | shape_condition = (betas if self.condition_hand_shape else |
| 421 | self.model_head.get_mean('shape', |
| 422 | batch_size=batch_size)) |
| 423 | right_finger_pose_condition = ( |
| 424 | right_hand_pose if self.condition_hand_finger_pose else |
| 425 | self.model_head.get_mean('right_hand_pose', batch_size=batch_size)) |
| 426 | right_hand_mean = torch.cat([ |
| 427 | right_wrist_pose, right_finger_pose_condition, shape_condition, |
| 428 | camera_mean |
| 429 | ], |
| 430 | dim=1) |
| 431 | |
| 432 | left_finger_pose_condition = ( |
| 433 | left_to_right_hand_pose if self.condition_hand_finger_pose else |
| 434 | self.model_head.get_mean('right_hand_pose', batch_size=batch_size)) |
| 435 | # Should be Bx31 |
| 436 | left_hand_mean = torch.cat([ |
| 437 | left_to_right_wrist_pose, left_finger_pose_condition, |
| 438 | shape_condition, camera_mean |
no test coverage detected