una-dinosauria / human-motion-prediction

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

About fkl function #26

Open DK-Jang opened 6 years ago

DK-Jang commented 6 years ago

Hello Julieta, I am a graduate student who is interested in motion prediction. I have questions about fkl function of _forwardkinematics.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.

una-dinosauria commented 6 years ago

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. https://github.com/una-dinosauria/human-motion-prediction/blob/c9a2774fe59bb78c6ec6d04e15f2cb7243c4348c/src/forward_kinematics.py#L48

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 https://github.com/una-dinosauria/human-motion-prediction/issues/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.

DK-Jang commented 6 years ago

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_touse from https://github.com/una-dinosauria/human-motion-prediction/blob/c9a2774fe59bb78c6ec6d04e15f2cb7243c4348c/src/translate.py#L684

I think these moving joints orders are equal to _dim_touse from https://github.com/una-dinosauria/human-motion-prediction/blob/c9a2774fe59bb78c6ec6d04e15f2cb7243c4348c/src/data_utils.py#L322

What do you think about this?

una-dinosauria commented 6 years ago

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.