Closed Maqingyang closed 5 years ago
BTW, I haven't figure out why the 3D joints have size of (B, 38, 3) in the model.smpl.py, and what's the difference between J_regressor and J_regressor_extra .
"""
This method is used to get the joint locations from the SMPL mesh
Input:
vertices: size = (B, 6890, 3)
Output:
3D joints: size = (B, 38, 3)
"""
joints = torch.einsum('bik,ji->bjk', [vertices, self.J_regressor])
joints_extra = torch.einsum('bik,ji->bjk', [vertices, self.J_regressor_extra])
joints = torch.cat((joints, joints_extra), dim=1)
joints = joints[:, cfg.JOINTS_IDX]
return joints
I did't use
# in config.py
# Indices to get the 14 LSP joints from the ground truth joints
J24_TO_J14 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 18]
when constructing H36MDataset()
. But I find it is used in eval.py. Do you use it in your origin code?
First, you might have to flip the SMPL pose as described here. This is probably why your are getting flipped shapes. The network tries to both match the output shape with the target shape and align it with the 2D keypoints, that's why you are getting these "spiky" shapes as output.
The size of the joints is 38 because different datasets have different joint definitions, so we take a superset of all those joints and apply the losses only on the relevant joints.
J24_TO_J14 gets the 14 lsp joints from the 24 SMPL joints and is used to evaluate MPJPE on H36M. During training we apply the joint loss on 17 joints, but we evaluate only on 14.
Thank you! It works now!
I have trained the model on Human3.6M and UP-3D. However, the model produces resonable results of UP-3D, but have upside-down results for Human3.6M, of which the head keypoint is alway wrong.
I have checked my
h36m_train.npz
using the following code (h36m_train.npz
is contained in classH36MDataset()
, similar toFullDataset()
). In the following code, I usebatch = dataset[2]
to directly get the img and annot batch, which already includes flip, rotation or adding noise. Notice that I have replacedself.to_lsp = list(range(14))
withself.to_h36m = list(range(13)) + [18]
, but this member seems not used in the train code, which may not be the cause(I'm not sure).And it seems that gt 2D pose is correct, and data preprocess(like flip and rotation) is also correct.
So, I doubt that problem lies in the training code. Could you help me to locate where the problem may come from? Thank you very much!
Any other detail on ask.