(gt_pose, pred_pose)
| 54 | |
| 55 | |
| 56 | def get_pose_error(gt_pose, pred_pose): |
| 57 | gt_q = rotation_matrix_to_quaternion(gt_pose[..., :3, :3]) # .cpu().numpy() |
| 58 | gt_t = gt_pose[..., :3, 3] |
| 59 | pred_q = rotation_matrix_to_quaternion(pred_pose[..., :3, :3]) # .cpu().numpy() |
| 60 | pred_t = pred_pose[..., :3, 3] |
| 61 | theta = gt_q.mul_(pred_q).sum(dim=-1).abs_().clamp_(-1., 1.).acos_().mul_(2 * 180 / math.pi) |
| 62 | error_x = torch.linalg.vector_norm(gt_t - pred_t, ord=2, dim=-1) |
| 63 | return error_x, theta |
| 64 | |
| 65 | def generate_rotation_error_bar(errors_rot, output_dir): |
| 66 |
no outgoing calls
no test coverage detected