Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

想请教一下SMPL参数估计的正确食用方式(扶 #18

Closed
syan2018 opened this issue Jan 5, 2023 · 6 comments
Closed

想请教一下SMPL参数估计的正确食用方式(扶 #18

syan2018 opened this issue Jan 5, 2023 · 6 comments

Comments

@syan2018
Copy link

syan2018 commented Jan 5, 2023

首先感谢一下开源(跪)

我们试着从一批FBX动画文件中批量导出关键点信息转成SMPL格式,但在使用这个工具时遇到了点儿问题

image

左图是example中给出的随机关键点,右图是被我们用于求解的关键点,乍一看问题不大

根据比例估算了一下scale为2.7,以上述关键点为输入,微调了一下example里的代码求解(如下)

def EstSMPLByKeypointAndScale(keypoints, scale):

    np.random.seed(20160923)

    pose_glb = np.zeros([1, 3]) # global rotation


    ########################## smpl settings ##########################
    # note that in smpl and smpl-h no pca for pose is provided
    # therefore in the model we fake an identity matrix as the pca coefficients
    # to make the code compatible

    n_pose = 23 * 3 # degrees of freedom, (n_joints - 1) * 3
    n_shape = 10
    pose_pca = np.random.uniform(-0.2, 0.2, size=n_pose)
    shape = np.random.normal(size=n_shape)
    mesh = KinematicModel(config.SMPL_MODEL_PATH, SMPLArmature, scale=scale)

    ########################## solving params ############################

    wrapper = KinematicPCAWrapper(mesh, n_pose=n_pose)
    solver = Solver(verbose=True)
  
    # 求解
    params_est = solver.solve(wrapper, keypoints)
  
    shape_est, pose_pca_est, pose_glb_est = wrapper.decode(params_est)

    print('----------------------------------------------------------------------')
    print('estimated parameters')
    print('pose pca coefficients:', pose_pca_est)
    print('pose global rotation:', pose_glb_est)
    print('shape: pca coefficients:', shape_est)

    mesh.set_params(pose_pca=pose_pca_est)
    mesh.save_obj('./est.obj')

    print('estimated meshes is saved into est.obj')

但是出来的估计结果mesh输出是这样的(不止一点邪典)

image

方便请教一下出了这个结果可能是哪一步出了问题吗(泪下),是输入数据分布不太合适、对Scale的微调不足、还是求解代码写错了😭

@CalciferZh
Copy link
Owner

感谢你的兴趣 :)

抱歉我没有时间去仔细读你的代码,只能给出一些一般性的建议。(这个项目太久远了,具体的细节我也忘了)。

首先,这个库的鲁棒性可能是比较糟糕的,我从来没在外部数据上测试过它。它仅仅满足了我自己的项目需求,然后顺手开源了。

其次,根据关键点信息求SMPL参数是一个比较难解的优化问题(具体参考inverse kinematics)。
由于解空间的性质很差,加上约束条件很少,当初始化里目标姿态比较远的时候,这个工具是基本解不出来的。
它目前应该只能用作最后的微调。当姿态大体正确的时候,它可以进一步缩小误差。

如果要从任意姿态的关键点信息求解SMPL参数,就一定需要大改这个项目,主要是加一些约束项来避免你的例子里面的问题。
这个项目只能作为一份初始的框架来演示通过优化求解SMPL参数的大致流程与思路。

最后,可以考虑搜索一下近期的一些用神经网络求解这一问题的方法,或许会有一些可用的开源结果。

@syan2018
Copy link
Author

syan2018 commented Jan 6, 2023

非常感谢🤦‍♂️,我再研究看看能不能找到些别的好法子

@luoww1992
Copy link

@syan2018
have you get a new method to get smpl pose by smpl 3d keypoints ?
can you share me ?

@syan2018
Copy link
Author

@syan2018 have you get a new method to get smpl pose by smpl 3d keypoints ? can you share me ?

maybe can try this repo joints2smpl

I also tried using MotionBuilder to retargeting the raw skeleton to SMPL fbx,then convert it to AMASS by this repo Fbx2SMPL

@Lanjiong-Li
Copy link

Lanjiong-Li commented Apr 11, 2024

@syan2018 hi, I am also working on turn custom dataset into SMPL parametric models. Can I discuss some technical details with you?

@syan2018
Copy link
Author

@syan2018 hi, I am also working on turn custom dataset into SMPL parametric models. Can I communicate with you?

of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants