una-dinosauria / human-motion-prediction

Simple baselines and RNNs for predicting human motion in tensorflow. Presented at CVPR 17.
MIT License
409 stars 142 forks source link

Can the preprocessed data converted to quaternions? #34

Open Ammola opened 6 years ago

Ammola commented 6 years ago

May I ask you @una-dinosauria a question?

Can the preprocessed data be converted to quaternions instead of exponential maps? Is there a code for the conversion? I would be very thankful to you if you can provide me with the same data you used but represented with quaternions instead of exponential maps.

Sorry If I'm asking the wrong question.

una-dinosauria commented 6 years ago

Can the preprocessed data be converted to quaternions instead of exponential maps?

Yes.

Is there a code for the conversion?

Look at https://github.com/una-dinosauria/human-motion-prediction/blob/master/src/data_utils.py. We have code to convert from expmat to rotation matrix, and then you can go from rotation matrix to quaternion.

I would be very thankful to you if you can provide me with the same data you used but represented with quaternions instead of exponential maps.

I don't usually write code for others, but I'm happy to give pointers to resources that will help you accomplish what you want.

Cheers,

Ammola commented 6 years ago

Thank you very much @una-dinosauria you're very helpful and very responsive. I did write some code for conversion before reading your answer :) I asked the question because I have no clue which values to be converted (angles) and which values to left without conversion (translation values).

From some comments here I realized that the first three values from every row are translation values (so these should not be considered in the conversion) while all other values should be converted. Because every angle will be represented as four quaternions, after the conversion every frame becomes 131 D vector (correct me If I'm wrong please).

To make sure that I did it correctly, I converted the angles back to exponential maps to see If I will get the original angles, and I got very similar values (with little differences). I'm sure my code is very basic and has lots of room for improvement :)
If you don't mind I will post the code here to get comments from experts like you.

Thanks again :) @una-dinosauria .

una-dinosauria commented 6 years ago

From some comments here I realized that the first three values from every row are translation values (so these should not be considered in the conversion) while all other values should be converted. Because every angle will be represented as four quaternions, after the conversion every frame becomes 131 D vector (correct me If I'm wrong please).

It should be 3 + 4*(n_joints). This sounds good to me.

o make sure that I did it correctly, I converted the angles back to exponential maps to see If I will get the original angles, and I got very similar values (with little differences). I'm sure my code is very basic and has lots of room for improvement :) If you don't mind I will post the code here to get comments from experts like you.

If you can convert back and forth, the program is probably correct. You may want to implement forward kinematics from quaternions and verify that you obtain the same result.

Ammola commented 6 years ago

Thanks @una-dinosauria I will try to implement FK from quaternions. I need to understand the meanings of values in each frame (the 99-long vector). I know that the first three values are 3D positions of the root and the following three values are 3D rotations of the root, but I don't know how the rest of the angles are ordered.
What is the structure of the skeleton in the H3.6M? Is it the same as that used in BioVision and AMC/ASF formats?
I've read their paper but there is nothing about the skeleton hierarchy.

una-dinosauria commented 6 years ago

Hi @Ammola,

What is the structure of the skeleton in the H3.6M?

Please have a look at the fkl function that we provide: https://github.com/una-dinosauria/human-motion-prediction/blob/c9a2774fe59bb78c6ec6d04e15f2cb7243c4348c/src/forward_kinematics.py#L14-L28

The parameters are all you need to understand the structure of the data, including rotation parameters and parent-child relations. You may want to look at https://en.wikipedia.org/wiki/Forward_kinematics to get familiar with the concepts.