mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-19 05:40:34 +08:00
Deprecate so3_exponential_map
Summary: Deprecate the `so3_exponential_map()` function in favor of its alias `so3_exp_map()`: this aligns with the naming of `so3_log_map()` and the recently introduced `se3_exp_map()` / `se3_log_map()` pair. Reviewed By: bottler Differential Revision: D29329966 fbshipit-source-id: b6f60b9e86b2995f70b1fbeb16f9feea05c55de9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f593bfd3c2
commit
5284de6e97
@@ -12,7 +12,7 @@ import numpy as np
|
||||
import torch
|
||||
from common_testing import TestCaseMixin, get_tests_dir
|
||||
from pytorch3d.ops import eyes
|
||||
from pytorch3d.transforms import so3_exponential_map, so3_log_map
|
||||
from pytorch3d.transforms import so3_exp_map, so3_log_map
|
||||
from pytorch3d.utils import (
|
||||
cameras_from_opencv_projection,
|
||||
opencv_from_cameras_projection,
|
||||
@@ -33,7 +33,7 @@ def cv2_project_points(pts, rvec, tvec, camera_matrix):
|
||||
"""
|
||||
Reproduces the `cv2.projectPoints` function from OpenCV using PyTorch.
|
||||
"""
|
||||
R = so3_exponential_map(rvec)
|
||||
R = so3_exp_map(rvec)
|
||||
pts_proj_3d = (
|
||||
camera_matrix.bmm(R.bmm(pts.permute(0, 2, 1)) + tvec[:, :, None])
|
||||
).permute(0, 2, 1)
|
||||
|
||||
@@ -53,7 +53,7 @@ from pytorch3d.renderer.cameras import (
|
||||
)
|
||||
from pytorch3d.transforms import Transform3d
|
||||
from pytorch3d.transforms.rotation_conversions import random_rotations
|
||||
from pytorch3d.transforms.so3 import so3_exponential_map
|
||||
from pytorch3d.transforms.so3 import so3_exp_map
|
||||
|
||||
|
||||
# Naive function adapted from SoftRasterizer for test purposes.
|
||||
@@ -145,7 +145,7 @@ def init_random_cameras(
|
||||
T = torch.randn(batch_size, 3) * 0.03
|
||||
if not random_z:
|
||||
T[:, 2] = 4
|
||||
R = so3_exponential_map(torch.randn(batch_size, 3) * 3.0)
|
||||
R = so3_exp_map(torch.randn(batch_size, 3) * 3.0)
|
||||
cam_params = {"R": R, "T": T}
|
||||
if cam_type in (OpenGLPerspectiveCameras, OpenGLOrthographicCameras):
|
||||
cam_params["znear"] = torch.rand(batch_size) * 10 + 0.1
|
||||
@@ -509,7 +509,7 @@ class TestCamerasCommon(TestCaseMixin, unittest.TestCase):
|
||||
def init_equiv_cameras_ndc_screen(cam_type: CamerasBase, batch_size: int):
|
||||
T = torch.randn(batch_size, 3) * 0.03
|
||||
T[:, 2] = 4
|
||||
R = so3_exponential_map(torch.randn(batch_size, 3) * 3.0)
|
||||
R = so3_exp_map(torch.randn(batch_size, 3) * 3.0)
|
||||
screen_cam_params = {"R": R, "T": T}
|
||||
ndc_cam_params = {"R": R, "T": T}
|
||||
if cam_type in (OrthographicCameras, PerspectiveCameras):
|
||||
|
||||
@@ -17,7 +17,7 @@ from pytorch3d.renderer.cameras import (
|
||||
SfMPerspectiveCameras,
|
||||
)
|
||||
from pytorch3d.transforms.rotation_conversions import random_rotations
|
||||
from pytorch3d.transforms.so3 import so3_exponential_map, so3_relative_angle
|
||||
from pytorch3d.transforms.so3 import so3_exp_map, so3_relative_angle
|
||||
from test_cameras import init_random_cameras
|
||||
|
||||
|
||||
@@ -95,9 +95,7 @@ class TestCamerasAlignment(TestCaseMixin, unittest.TestCase):
|
||||
) * s_align_gt
|
||||
|
||||
if add_noise != 0.0:
|
||||
R_new = torch.bmm(
|
||||
R_new, so3_exponential_map(torch.randn_like(T_new) * add_noise)
|
||||
)
|
||||
R_new = torch.bmm(R_new, so3_exp_map(torch.randn_like(T_new) * add_noise))
|
||||
T_new += torch.randn_like(T_new) * add_noise
|
||||
|
||||
# create new cameras from R_new and T_new
|
||||
|
||||
@@ -15,7 +15,7 @@ from pytorch3d.ops.sample_points_from_meshes import sample_points_from_meshes
|
||||
from pytorch3d.structures.meshes import Meshes
|
||||
from pytorch3d.structures.pointclouds import Pointclouds
|
||||
from pytorch3d.structures.volumes import Volumes
|
||||
from pytorch3d.transforms.so3 import so3_exponential_map
|
||||
from pytorch3d.transforms.so3 import so3_exp_map
|
||||
|
||||
|
||||
DEBUG = False
|
||||
@@ -138,7 +138,7 @@ def init_uniform_y_rotations(batch_size: int = 10):
|
||||
angles = torch.linspace(0, 2.0 * np.pi, batch_size + 1, device=device)
|
||||
angles = angles[:batch_size]
|
||||
log_rots = axis[None, :] * angles[:, None]
|
||||
R = so3_exponential_map(log_rots)
|
||||
R = so3_exp_map(log_rots)
|
||||
return R
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ from pytorch3d.renderer import (
|
||||
)
|
||||
from pytorch3d.renderer.cameras import get_world_to_view_transform
|
||||
from pytorch3d.transforms import Transform3d
|
||||
from pytorch3d.transforms.so3 import so3_exponential_map
|
||||
from pytorch3d.transforms.so3 import so3_exp_map
|
||||
from torch.utils.data import DataLoader
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ class TestR2N2(TestCaseMixin, unittest.TestCase):
|
||||
"""
|
||||
# Test get_world_to_view_transform.
|
||||
T = torch.randn(10, 3)
|
||||
R = so3_exponential_map(torch.randn(10, 3) * 3.0)
|
||||
R = so3_exp_map(torch.randn(10, 3) * 3.0)
|
||||
RT = get_world_to_view_transform(R=R, T=T)
|
||||
cam = BlenderCamera(R=R, T=T)
|
||||
RT_class = cam.get_world_to_view_transform()
|
||||
|
||||
@@ -10,7 +10,7 @@ import unittest
|
||||
|
||||
import torch
|
||||
from common_testing import TestCaseMixin
|
||||
from pytorch3d.transforms.so3 import so3_exponential_map
|
||||
from pytorch3d.transforms.so3 import so3_exp_map
|
||||
from pytorch3d.transforms.transform3d import (
|
||||
Rotate,
|
||||
RotateAxisAngle,
|
||||
@@ -146,7 +146,7 @@ class TestTransform(TestCaseMixin, unittest.TestCase):
|
||||
self.assertTrue(torch.allclose(normals_out, normals_out_expected))
|
||||
|
||||
def test_rotate(self):
|
||||
R = so3_exponential_map(torch.randn((1, 3)))
|
||||
R = so3_exp_map(torch.randn((1, 3)))
|
||||
t = Transform3d().rotate(R)
|
||||
points = torch.tensor([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.5, 0.5, 0.0]]).view(
|
||||
1, 3, 3
|
||||
@@ -273,7 +273,7 @@ class TestTransform(TestCaseMixin, unittest.TestCase):
|
||||
)
|
||||
elif choice <= 2.0 / 3.0:
|
||||
t_ = Rotate(
|
||||
so3_exponential_map(
|
||||
so3_exp_map(
|
||||
torch.randn(
|
||||
(batch_size, 3), dtype=torch.float32, device=device
|
||||
)
|
||||
@@ -894,7 +894,7 @@ class TestRotate(unittest.TestCase):
|
||||
def test_inverse(self, batch_size=5):
|
||||
device = torch.device("cuda:0")
|
||||
log_rot = torch.randn((batch_size, 3), dtype=torch.float32, device=device)
|
||||
R = so3_exponential_map(log_rot)
|
||||
R = so3_exp_map(log_rot)
|
||||
t = Rotate(R)
|
||||
im = t.inverse()._matrix
|
||||
im_2 = t._matrix.inverse()
|
||||
|
||||
Reference in New Issue
Block a user