From 4dda5a2d7a77027ee80f0410950faaaad3b29311 Mon Sep 17 00:00:00 2001 From: eigenvivek Date: Tue, 5 Dec 2023 17:08:55 -0500 Subject: [PATCH] Undo pytorch3d transpose convention --- diffpose/calibration.py | 8 +++++--- notebooks/api/02_calibration.ipynb | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/diffpose/calibration.py b/diffpose/calibration.py index 2b9cc63..66a1c9e 100644 --- a/diffpose/calibration.py +++ b/diffpose/calibration.py @@ -91,8 +91,8 @@ def convert( transform = torch.concat([*transform], axis=-1) matrix = se3_exp_map(transform) transform = RigidTransform( - R=matrix[..., :3, :3].transpose(-1, -2), - t=matrix[..., 3, :3], + R=matrix[..., :3, :3], + t=matrix[..., :3, 3], device=matrix.device, dtype=matrix.dtype, ) @@ -111,7 +111,9 @@ def convert( return transform elif output_parameterization == "se3_log_map": se3_log = transform.get_se3_log() - return se3_log[..., :3], se3_log[..., 3:] + log_R_vee = se3_log[..., :3] + log_t_vee = se3_log[..., 3:] + return log_R_vee, log_t_vee else: return ( transform.get_rotation(output_parameterization, output_convention), diff --git a/notebooks/api/02_calibration.ipynb b/notebooks/api/02_calibration.ipynb index a8d2934..6ad9380 100644 --- a/notebooks/api/02_calibration.ipynb +++ b/notebooks/api/02_calibration.ipynb @@ -194,8 +194,8 @@ " transform = torch.concat([*transform], axis=-1)\n", " matrix = se3_exp_map(transform)\n", " transform = RigidTransform(\n", - " R=matrix[..., :3, :3].transpose(-1, -2),\n", - " t=matrix[..., 3, :3],\n", + " R=matrix[..., :3, :3],\n", + " t=matrix[..., :3, 3],\n", " device=matrix.device,\n", " dtype=matrix.dtype,\n", " )\n", @@ -214,7 +214,9 @@ " return transform\n", " elif output_parameterization == \"se3_log_map\":\n", " se3_log = transform.get_se3_log()\n", - " return se3_log[..., :3], se3_log[..., 3:]\n", + " log_R_vee = se3_log[..., :3]\n", + " log_t_vee = se3_log[..., 3:]\n", + " return log_R_vee, log_t_vee\n", " else:\n", " return (\n", " transform.get_rotation(output_parameterization, output_convention),\n",