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

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

Closed
Saafke opened this issue Jun 3, 2021 · 11 comments

Comments

@Saafke
Copy link

Saafke commented Jun 3, 2021

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
Copy link
Collaborator

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.

@Saafke Saafke closed this as completed Jun 7, 2021
@abhaydoke09
Copy link

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

@Saafke
Copy link
Author

Saafke commented Jun 8, 2021

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
Copy link

Thanks.. it worked

@Elsaam2y
Copy link

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
Copy link

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
Copy link

@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
Copy link

ericyu0510 commented Aug 26, 2021

@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
Copy link

@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
Copy link

ericyu0510 commented Aug 27, 2021

@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......

smidm added a commit to haleyai/smplify-x that referenced this issue Dec 1, 2021
smidm added a commit to haleyai/smplify-x that referenced this issue Dec 1, 2021
for vposer users:

`torchgeometry` package is not compatible with modern `torch`.  kornia, `torchgeometry` descendant has a bug that affects `human_body_prior`.
see nghorbani/human_body_prior#16, bert-nmt/bert-nmt#3, kornia/kornia#317

resolution: install patched kornia https://github.com/nghorbani/kornia/tree/BugFix%23317 and use it instead of `torchgeometry` (also requires small vposer code fix)

see vchoutas#144
@qingqing5r44
Copy link

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

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

7 participants