Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perhaps bugs when converting axisangle to rotation matrix #7

Open
kyang-06 opened this issue Sep 14, 2020 · 2 comments
Open

Perhaps bugs when converting axisangle to rotation matrix #7

kyang-06 opened this issue Sep 14, 2020 · 2 comments

Comments

@kyang-06
Copy link

Very impressive and elegant theory to push this field forward!

But I notice there may exist a bug.

axis, theta = normalize_vector(rod, return_mag=True)
sin = torch.sin(theta)
qw = torch.cos(theta)
qx = axis[:,0]*sin
qy = axis[:,1]*sin
qz = axis[:,2]*sin

theta = torch.tanh(axisAngle[:,0])*np.pi #[-180, 180]
sin = torch.sin(theta)
axis = normalize_vector(axisAngle[:,1:4]) #batch*3
qw = torch.cos(theta)
qx = axis[:,0]*sin
qy = axis[:,1]*sin
qz = axis[:,2]*sin

Code above are the function converting axisangle/rodrigues to rotation matrix.
The θ passed to torch.sin and torch.cos is the identity but should be θ/2 instead, referring to Maths - AxisAngle to Quaternion
I've hand-written a toy case (rotate y axis by 90 degrees around x axis) and only θ/2 is correct.

I wonder if it is a bug, and if so, does it influence other conversion functions and further influence result of experiments?

@papagina
Copy link
Owner

Hi, thank you for examining our code! You are right, the function should be θ/2, but since the scaling can be accommodated by the neural network, it wouldn't influence the approximation capability of the network for the representations. To justify it, I also ran the training with the scaled θ and the result remains similar.

@meaten
Copy link

meaten commented Oct 8, 2021

Thanks for the great work!
I also noticed that compute_rotation_matrix_from_Rodriguez has the same mistakes on halving theta.
Could you kindly update tools.py for anyone using your codes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants