vchoutas / smplify-x

Expressive Body Capture: 3D Hands, Face, and Body from a Single Image
https://smpl-x.is.tue.mpg.de/
Other
1.73k stars 335 forks source link

ImportError: cannot import name 'load_vposer' from 'human_body_prior.tools.model_loader' #144

Closed Saafke closed 3 years ago

Saafke commented 3 years ago

Hi,

In the file fit_single_frame.py the code wants to import load_vposer from human_body_prior.tools.model_loader

However, there does not seem to be a load_vposer() function in human_body_prior/tools/model_loader.py. What am I missing here?

nghorbani commented 3 years ago

human body prior had a major update recently. You could either use the old version tagged as cvpr19 or make these modifications in your code: body_pose = vposer.decode(pose_embedding, output_type='aa').view(1, -1) if use_vposer else None to body_pose = (vposer.decode(pose_embedding).get( 'pose_body')).reshape(1, -1) if use_vposer else None and use these imports from human_body_prior.tools.model_loader import load_model from human_body_prior.models.vposer_model import VPoser. Finally, change vposer, _ = load_vposer(vposer_ckpt, vp_model='snapshot') to vposer, _ = load_model(vposer_ckpt, model_code=VPoser, remove_words_in_model_weights='vp_model.', disable_grad=True).

I will try to add these in a PR.

abhaydoke09 commented 3 years ago

Can you please provide a link for "old version tagged as cvpr19"? Thanks in advance

Saafke commented 3 years ago

Can you please provide a link for "old version tagged as cvpr19"? Thanks in advance

I think it's the other branch 'cpvr19' : https://github.com/nghorbani/human_body_prior/tree/cvpr19

abhaydoke09 commented 3 years ago

Thanks.. it worked

Elsaam2y commented 3 years ago

I have followed updated the code as explained by @nghorbani but I keep getting the following error: AssertionError: No checck points found at vposer_v1_0/snapshots. I have already downloaded vpose from simplex and in snapshots I have the checkpoint .pt should I use the second version of vposer? Even if I use it, I get into other errors like: model_ps_fname = model_ps_fname[0] IndexError: list index out of range

Any suggestions about what I am missing?

univ-esuty commented 3 years ago

Hello @Elsaam2y. I used the second version of vposer and I got the same error IndexError: list index out of range .

Did you place V02_05.log and V02_05.yaml files included in the download file on your working VPOSER_FOLDER directory. I don't know whether these files are important or not, but the error disappeared in my environment after I placed these files.

Elsaam2y commented 3 years ago

@klab-shirakawa thanks for your response. I actually made a mistake while installing the cvpr19 version of vposer and fixed it. Now I am using the old version without modifying the code. Before that, I haven't replaced this files and your solution should be absolutely right. Thanks again.

ericyu0510 commented 3 years ago

@Elsaam2y Can you explain how you solve the problem, I met exactly the same problem as you did. What mistake did you make while installing the cvpr19 version of vposer. By the way, there are 2 V02_05 folders, one is the folder downloaded in SMPL-X download page, another is inside human_body_prior\src\human_body_prior\train. What should I do with each of them?

Elsaam2y commented 3 years ago

@ericyu0510 you need to switch to this branch , install dependancies and run python setup.py install. This should fix the problem without any modification to the code. You need to download VPoser v1.0 - CVPR 2019 from smplx website. This should solve the problem.

ericyu0510 commented 3 years ago

@Elsaam2y Thank you for your help. But I found out that VPoser v1.0 requires pytorch1.1 which my RTX 3080 does not support. It seems to be a deadlock......

qingqing5r44 commented 2 years ago

I have written a blog including some solutions of those problems mentioned above. I just use the latest version of vposer, pytorch 1.8.0 and run the smplifyx code on Windows successfully.

Blog Link: https://blog.csdn.net/weixin_44034102/article/details/123523443