I am trying to use the Quaternion form instead of rotation matrices.
I already trained my model, but when I need to test the model, I must compute Euler angles from the Quaternion form as this person did with computing Euler angles from rotation matrices.
For example, the output in Quaternion form for B = batch_size = 2 (-> Bx4) is :
tensor([[ 0.0725, -0.0645, 0.0308, 0.9948],
[-0.5235, -0.2456, 0.0824, 0.8117]], device='cuda:0')
And, the output in rotation matrices form for B = batch_size = 2 (-> Bx3x3) :
tensor([[[ 0.9933, -0.0871, 0.0755],
[ 0.0850, 0.9959, 0.0316],
[-0.0779, -0.0250, 0.9966]],
[[ 0.7244, -0.0551, -0.6871],
[ 0.2493, 0.9503, 0.1866],
[ 0.6427, -0.3065, 0.7021]]], device='cuda:0')
Note: this is output for batch_size; it is not one frame or one image.
Could you help me with how we can compute Euler angles from Quaternion form?