Exemple #1
0
    def get_landmarks(self):
        """Computes body25 joints for SMPL along with hand and facial landmarks"""

        verts, _, _, _ = self.smpl(self.pose,
                                  th_betas=self.betas,
                                  th_trans=self.trans,
                                  th_offsets=self.offsets)

        J = batch_sparse_dense_matmul(self.body25_reg_torch, verts)
        face = batch_sparse_dense_matmul(self.face_reg_torch, verts)
        hands = batch_sparse_dense_matmul(self.hand_reg_torch, verts)

        return J, face, hands
Exemple #2
0
def get_pose_obj(pose_3d, smpl):
    # Bharat: Why do we have torch, chumpy and numpy in the same function. It seems all the ops can be done in torch.

    body25_reg_torch, face_reg_torch, hand_reg_torch = torch_pose_obj_data()
    ipdb.set_trace()
    verts, _, _, _ = smpl.forward()
    J = batch_sparse_dense_matmul(body25_reg_torch, verts)
    face = batch_sparse_dense_matmul(face_reg_torch, verts)
    hands = batch_sparse_dense_matmul(hand_reg_torch, verts)

    J_observed = pose_3d['pose_keypoints_3d']
    face_observed = pose_3d['face_keypoints_3d']
    hands_observed = np.vstack((pose_3d['hand_left_keypoints_3d'], pose_3d['hand_right_keypoints_3d']))

    hands_observed[:, 3][hands_observed[:, 3] < HAND_VISIBLE] = 0.

    #
    return ch.vstack((
        (J - J_observed[:, :3]) * J_observed[:, 3].reshape((-1, 1)),
        (face - face_observed[:, :3]) * face_observed[:, 3].reshape((-1, 1)),
        (hands - hands_observed[:, :3]) * hands_observed[:, 3].reshape((-1, 1)),
        ))