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

Errors in fitting.py #209

Open
shrutic12 opened this issue Sep 26, 2023 · 2 comments
Open

Errors in fitting.py #209

shrutic12 opened this issue Sep 26, 2023 · 2 comments

Comments

@shrutic12
Copy link

No description provided.

@shrutic12
Copy link
Author

shrutic12 commented Sep 26, 2023

Hi! I am running the code as follows:

python smplifyx/main.py --config cfg_files/fit_smpl.yaml --data_folder Data --output_folder Output --visualize=True --model_folder Models --vposer_ckpt V02_05 --part_segm_fn smplx_parts_segm.pkl --use_cuda=False

I have changed interpretation = False in the .yaml file. I do not have cuda and want to see the results I can get from running on CPU.

Now I am seeing some errors in the fitting.py file in the lines 74 to 80:

body_pose = vposer.decode( pose_embedding, output_type='aa').view(1, -1) if use_vposer else None if use_vposer and model_type == 'smpl': wrist_pose = torch.zeros([body_pose.shape[0], 6], dtype=body_pose.dtype, device=body_pose.device) body_pose = torch.cat([body_pose, wrist_pose], dim=1)

I did some debugging and printed body_pose and it turns out body_pose is a dictionary which looks like this :

{'pose_body': tensor([[[-1.6974e-01, 3.9069e-02, 9.6282e-02], [-2.3981e-01, -5.0767e-02, -1.1809e-01], [ 2.4283e-01, 7.0910e-03, 9.4865e-03], [ 4.0049e-01, -2.3190e-02, -8.2887e-02], [ 4.7860e-01, -3.5693e-02, 4.6262e-02], [ 3.4491e-02, -4.0437e-02, 4.2832e-03], [-2.0321e-01, 2.0849e-01, 4.3582e-02], [-2.0967e-01, -1.5414e-01, 4.9889e-02], [ 3.9330e-02, 1.6497e-03, 5.0509e-03], [-1.6907e-04, 6.9093e-05, 9.9793e-06], [-4.4900e-05, 3.2197e-05, -2.7058e-05], [ 1.2475e-02, 2.0093e-02, -3.1115e-02], [-7.2320e-04, -5.3594e-02, -2.6114e-01], [ 1.2968e-02, 1.2447e-01, 2.2587e-01], [-7.8002e-02, -1.3200e-02, 4.9869e-02], [ 1.0644e-01, -2.0751e-01, -7.2850e-01], [ 1.4538e-01, 2.3604e-01, 7.4197e-01], [ 9.2566e-02, -9.1464e-01, 1.3255e-01], [ 9.8511e-02, 9.6942e-01, -2.3718e-01], [-3.0695e-01, -2.3050e-01, 8.9209e-02], [-2.2371e-01, 1.9913e-01, -4.0717e-02]]]), 'pose_body_matrot': tensor([[[ 9.9462e-01, -9.8952e-02, 3.0667e-02, 9.2343e-02, 9.8102e-01, 1.7049e-01, -4.6956e-02, -1.6674e-01, 9.8488e-01], [ 9.9179e-01, 1.2269e-01, -3.6070e-02, -1.1059e-01, 9.6449e-01, 2.3984e-01, 6.4216e-02, -2.3389e-01, 9.7014e-01], [ 9.9993e-01, -8.5366e-03, 8.1675e-03, 1.0250e-02, 9.7062e-01, -2.4041e-01, -5.8752e-03, 2.4048e-01, 9.7064e-01], [ 9.9635e-01, 7.6009e-02, -3.8914e-02, -8.5168e-02, 9.1753e-01, -3.8844e-01, 6.1802e-03, 3.9033e-01, 9.2065e-01], [ 9.9833e-01, -5.2867e-02, -2.3469e-02, 3.6113e-02, 8.8662e-01, -4.6108e-01, 4.5184e-02, 4.5946e-01, 8.8705e-01], [ 9.9917e-01, -4.9784e-03, -4.0344e-02, 3.5840e-03, 9.9940e-01, -3.4561e-02, 4.0492e-02, 3.4388e-02, 9.9859e-01], [ 9.7748e-01, -6.3987e-02, 2.0110e-01, 2.1925e-02, 9.7856e-01, 2.0479e-01, -2.0989e-01, -1.9577e-01, 9.5792e-01], [ 9.8695e-01, -3.3242e-02, -1.5755e-01, 6.5373e-02, 9.7691e-01, 2.0341e-01, 1.4715e-01, -2.1105e-01, 9.6634e-01], [ 9.9999e-01, -5.0172e-03, 1.7486e-03, 5.0820e-03, 9.9921e-01, -3.9316e-02, -1.5500e-03, 3.9324e-02, 9.9923e-01], [ 1.0000e+00, -9.9833e-06, 6.9092e-05, 9.9753e-06, 1.0000e+00, 1.6907e-04, -6.9093e-05, -1.6907e-04, 1.0000e+00], [ 1.0000e+00, 2.7058e-05, 3.2198e-05, -2.7057e-05, 1.0000e+00, 4.4900e-05, -3.2196e-05, -4.4901e-05, 1.0000e+00], [ 9.9931e-01, 3.1232e-02, 1.9894e-02, -3.0982e-02, 9.9944e-01, -1.2785e-02, -2.0282e-02, 1.2160e-02, 9.9972e-01], [ 9.6468e-01, 2.5808e-01, -5.2868e-02, -2.5804e-01, 9.6610e-01, 7.6711e-03, 5.3055e-02, 6.2418e-03, 9.9857e-01], [ 9.6693e-01, -2.2256e-01, 1.2455e-01, 2.2417e-01, 9.7455e-01, 1.1553e-03, -1.2164e-01, 2.6803e-02, 9.9221e-01], [ 9.9867e-01, -4.9282e-02, -1.5125e-02, 5.0311e-02, 9.9572e-01, 7.7560e-02, 1.1238e-02, -7.8218e-02, 9.9687e-01], [ 7.2683e-01, 6.4899e-01, -2.2478e-01, -6.7003e-01, 7.4194e-01, -2.4389e-02, 1.5094e-01, 1.6833e-01, 9.7410e-01], [ 7.1240e-01, -6.5051e-01, 2.6329e-01, 6.8306e-01, 7.2881e-01, -4.7561e-02, -1.6095e-01, 2.1373e-01, 9.6354e-01], [ 6.0277e-01, -1.5367e-01, -7.8298e-01, 7.4919e-02, 9.8784e-01, -1.3620e-01, 7.9439e-01, 2.3437e-02, 6.0695e-01], [ 5.4235e-01, 2.4326e-01, 8.0416e-01, -1.5550e-01, 9.6969e-01, -1.8846e-01, -8.2564e-01, -2.2838e-02, 5.6374e-01], [ 9.6985e-01, -5.1997e-02, -2.3810e-01, 1.2184e-01, 9.4957e-01, 2.8891e-01, 2.1107e-01, -3.0921e-01, 9.2728e-01], [ 9.7950e-01, 1.7995e-02, 2.0064e-01, -6.2205e-02, 9.7434e-01, 2.1629e-01, -1.9160e-01, -2.2434e-01, 9.5549e-01]]])}

And it is giving me TypeError in the vposer.decode function which says decode() got an unexpected keyword argument 'output_type':
image

I removed the output_type and then also got an error for .view() part of the argument which shows an AttributeError:

image

So I also removed that and now the changed code looked like the following:

body_pose = vposer.decode( pose_embedding) if use_vposer else None if use_vposer and model_type == 'smpl': wrist_pose = torch.zeros([body_pose.shape[0], 6], dtype=body_pose.dtype, device=body_pose.device) body_pose = torch.cat([body_pose, wrist_pose], dim=1)

BUT this still gives errors as the wrist_pose = torch.zeros([body_pose.shape[0], 6],
dtype=body_pose.dtype,
device=body_pose.device)
seems to want bodu_pose to be a numpy array but is a dictionary as I showed above. The dictionary body_pose also does not have any attribute called "device". So I changed the code to :

body_pose = vposer.decode( pose_embedding) if use_vposer else None if use_vposer and model_type == 'smpl': print(body_pose) wrist_pose = torch.zeros([body_pose['pose_body'].shape[0], 6], dtype=body_pose['pose_body'].dtype) print(wrist_pose) body_pose = torch.cat([body_pose['pose_body'], wrist_pose], dim=1)

However, at this point I've made multiple changes to the code and in the last line the tensor dimensions do not agree.

Can someone tell me what is going on and where I am going wrong?
Am I using an old version of the code?

Thanks a lot @vchoutas @geopavlakos @dimtzionas @MichaelJBlack

@shrutic12 shrutic12 changed the title EWrrors in fitting Errors in fitting.py Sep 26, 2023
@YixuannnL
Copy link

I have the same problem, have you figured it out?

@vchoutas @geopavlakos @dimtzionas @MichaelJBlack @shrutic12

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

2 participants