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

Question about Augmentor #23

Open
LAB123-tech opened this issue Oct 12, 2023 · 0 comments
Open

Question about Augmentor #23

LAB123-tech opened this issue Oct 12, 2023 · 0 comments

Comments

@LAB123-tech
Copy link

It's a nice job which really inspired me a lot. But I have a question need to answer.

Well, I can't understand the idea of generating a 3×3 rotation matrix from a quaternion vector in a augmentor. What is the meaning of the function of batch_quat_to_rotmat? The idea of the funtion batch_quat_to_rotmat does not embodies in the paper. Looking forward to your reply. Thank you very much.

def batch_quat_to_rotmat(q, out=None):
B = q.size(0)
if out is None:
out = q.new_empty(B, 3, 3)
# 2 / squared quaternion 2-norm
len = torch.sum(q.pow(2), 1)
s = 2 / len
s_ = torch.clamp(len, 2.0 / 3.0, 3.0 / 2.0)
# coefficients of the Hamilton product of the quaternion with itself
h = torch.bmm(q.unsqueeze(2), q.unsqueeze(1))
out[:, 0, 0] = (1 - (h[:, 2, 2] + h[:, 3, 3]).mul(s)) # .mul(s_)
out[:, 0, 1] = (h[:, 1, 2] - h[:, 3, 0]).mul(s)
out[:, 0, 2] = (h[:, 1, 3] + h[:, 2, 0]).mul(s)
out[:, 1, 0] = (h[:, 1, 2] + h[:, 3, 0]).mul(s)
out[:, 1, 1] = (1 - (h[:, 1, 1] + h[:, 3, 3]).mul(s)) # .mul(s_)
out[:, 1, 2] = (h[:, 2, 3] - h[:, 1, 0]).mul(s)
out[:, 2, 0] = (h[:, 1, 3] - h[:, 2, 0]).mul(s)
out[:, 2, 1] = (h[:, 2, 3] + h[:, 1, 0]).mul(s)
out[:, 2, 2] = (1 - (h[:, 1, 1] + h[:, 2, 2]).mul(s)) # .mul(s_)
return out, s_

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

1 participant