una-dinosauria/human-motion-prediction

About fkl function

DK-Jang opened this issue · 3 comments

Hello Julieta,
I am a graduate student who is interested in motion prediction.
I have questions about fkl function of forward_kinematics.py.

  1. The dimension of the angles received by the fkl function is 99, the first dim 1,2 and 3 represents the translation of the root joint, the dim 4, 5 and 6 represent the Exp.Coord of the root joint, dim 7~99 represent the Exp.coord of the remaining joints. Is it correct?

  2. I do not know what rotInd and expmapInd represent. Looking at line 48 of forward_kinematics.py, position is updated with thisPosition = np.array ([xangle, yangle, zangle]), where xangle, yangle, and zangle are Exp.coord. xangle, yangle, and zangle are Exp.coord, why does this represent position?
    Line 52 does not make sense to update xyz by adding offset (bone length).

  3. The 54,55 line forward kinematics part is not well understood. I would be very grateful if you could explain it.

Hi @DK-Jang,

  1. The dimension of the angles received by the fkl function is 99, the first dim 1,2 and 3 represents the translation of the root joint, the dim 4, 5 and 6 represent the Exp.Coord of the root joint, dim 7~99 represent the Exp.coord of the remaining joints. Is it correct?

Correct!

  1. I do not know what rotInd and expmapInd represent. Looking at line 48 of forward_kinematics.py, position is updated with thisPosition = np.array ([xangle, yangle, zangle]), where xangle, yangle, and zangle are Exp.coord. xangle, yangle, and zangle are Exp.coord, why does this represent position?
    Line 52 does not make sense to update xyz by adding offset (bone length).

PRO TIP: Use permalinks when you refer to code in issues.

thisPosition = np.array([xangle, yangle, zangle])

My code is a python port of the Matlab function by @gwtaylor at https://github.com/gwtaylor/imCRBM/blob/master/Motion/exp2xyz.m

I believe I made some mistakes when I simplified the logic (eg adding position to angles when I shouldn't have), but these do not seem to be numerically significant -- please see #23.

If you come to understand the code better, please consider submitting a pull request to fix the code.

3.The 54,55 line forward kinematics part is not well understood. I would be very grateful if you could explain it.

This is the core of forward kinematics: https://en.wikipedia.org/wiki/Forward_kinematics. To obtain the position of the kth joint down the kinematic tree, we have to apply the rotations of the previous (k-1) joints, and add the bone offsets.

Thank you for your kindness! :)

I read #23 you said. It seems to me that my curiosity has been resolved.

But, There are still strange parts for me. You said, "Regarding the 32 joints, I believe only 17 are independent, and the rest are end effectors as you call them." in #23. I think 17 independent joints are 0,1,2,3,6,7,8,12,13,14,15,17,18,19,25,26, and 27 (refer to https://github.com/una-dinosauria/3d-pose-baseline/blob/1ca400232ad6158050d8b292ac812d94dbb49d74/src/data_utils.py#L20-L38).
But this joint order is different with dimensions_to_use from

data_mean, data_std, dim_to_ignore, dim_to_use = data_utils.normalization_stats(complete_train)

I think these moving joints orders are equal to dim_to_use from

dimensions_to_use.extend( list(np.where(data_std >= 1e-4)[0]) )

What do you think about this?

You're taking code from two different repos.
In 3d-pose-baseline we use 3d joints, not 3d angles.
The numbers of joints in 3d and in the kinematic tree don't necessarily have to agree -- you may confirm this by looking at the order of the joints in the fkl function.