| | |
| | | face_y = tdy - 0.50 * size |
| | | else: |
| | | height, width = img.shape[:2] |
| | | face_x = width / 2 - 0.15 - size |
| | | face_y = height / 2 - 0.15 - size |
| | | face_x = width / 2 - 0.5 * size |
| | | face_y = height / 2 - 0.5 * size |
| | | |
| | | x1 = size * (cos(y) * cos(r)) + face_x |
| | | y1 = size * (cos(p) * sin(r) + cos(r) * sin(p) * sin(y)) + face_y |
| | |
| | | pose_params = pre_pose_params[:3] |
| | | return pose_params |
| | | |
| | | def get_pt2d_from_mat(mat_path): |
| | | # Get 2D landmarks |
| | | mat = sio.loadmat(mat_path) |
| | | pt2d = mat['pt2d'] |
| | | return pt2d |
| | | |
| | | def mse_loss(input, target): |
| | | return torch.sum(torch.abs(input.data - target.data) ** 2) |