Comments (3)
Also, more broadly speaking, this is the sort of function I was hoping to implement with lietorch:
def get_rays(directions, c2w):
# Rotate ray directions from camera coordinate to the world coordinate
rays_d = directions @ c2w[:, :, :3].transpose(1, 2) # (n, H*W, 3)
# The origin of all rays is the camera origin in world coordinate
rays_o = c2w[:, :, 3].unsqueeze(1).expand(rays_d.shape) # (n, H*W, 3)
return torch.cat((rays_o, rays_d), -1)
Where directions is an (N, M, 3) tensor and c2w would be an SE3 transform. Note that the rotation and translation components of the transform are treated separately. So ideally I'd be able to:
- Get the rotation component of the SE3 transform and call the equivalent of [tensor * rotation_transposed] on it
- Also extract the translation vector from the SE3 transform
The easiest solution I could think of was to call the matrix() function on the SE3 transform, but doesn't currently seem to be differentiable.
from lietorch.
Hi, that function is possible to implement. In your code, you just need to add a dimension to so3
a = torch.FloatTensor([0.4230, 0.5557, 0.3167, 0.6419])
b = torch.rand(10, 3)
so3 = SO3(a)
so3[None].act(b)
or if you were acting on an even higher dimensional point cloud
a = torch.FloatTensor([0.4230, 0.5557, 0.3167, 0.6419])
b = torch.rand(10,10,10, 3)
so3 = SO3(a)
so3[None,None,None].act(b)
Right now, broadcasting assumes that both the group element and point have the same number of dimension, so you have to manually expand the dimensions you want to broadcast over.
from lietorch.
hi, I want to implement a toy example for optimizing rotation, here is my code, but it did not converge, are there any wrong things in my code?
import torch
from pytorch3d.transforms import random_rotation
from lietorch import SO3
x = torch.randn(100, 3, requires_grad=False).cuda()
rotation = random_rotation().cuda().requires_grad_(False)
print(rotation)
y = x @ rotation
class Model(torch.nn.Module):
def __init__(self):
super(Model, self).__init__()
self.phi = torch.nn.Parameter(torch.randn(1, 3, requires_grad=True).cuda())
def forward(self, x):
so3 = SO3(self.phi)
return so3.act(x)
model = Model().cuda()
optimizer = torch.optim.Adam(model.parameters(), lr=0.0001)
for i in range(1000):
y_hat = model(x)
loss = torch.nn.functional.mse_loss(y_hat, y.detach())
optimizer.zero_grad()
loss.backward(retain_graph=True)
optimizer.step()
print(loss.item())
print(SO3(model.phi).matrix())
from lietorch.
Related Issues (20)
- CUDA version mismatch HOT 1
- CPU only version? HOT 1
- bug in SE3.matrix()? HOT 1
- compile the code HOT 1
- Is there a version that runs on linux?
- .
- vec() method failing.
- Not available on win10 HOT 13
- It seems that the operator in lietorch.extra doesn't support DDP.
- eigen link
- Question about the Jacobian of the exponential map
- cannot install the package HOT 4
- Possible bug in gradient size of mul_backward_kernel()?
- Broadcasting of action on point cloud HOT 1
- bug in float() and double()
- what does * mean for SE3 type data?
- 'map' object has no attribute 'shape'
- Comparison with Pytorch3D
- How to convert from 4*4 transformation matrix to se(3) using lietorch HOT 1
- matrix function have diffurent behaviors for random select
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lietorch.