Skip to content

Question about Augmentor #23

@LAB123-tech

Description

@LAB123-tech

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_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions