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

RuntimeError: The size of tensor a (118) must match the size of tensor b (111) at non-singleton dimension 1 #208

Open
bohanfeng opened this issue Sep 15, 2023 · 6 comments

Comments

@bohanfeng
Copy link

python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder input_image1/ --output_folder OUTPUT_FOLDER --visualize="True" --model_folder models_smplx_v1_1/ --vposer_ckpt V02_05/ --part_segm_fn smplx_parts_segm.pkl
Processing: input_image1/images/2023-09-15-165143.jpg
2023-09-15 17:08:35.404 | INFO | human_body_prior.tools.model_loader:load_model:77 - No GPU detected. Loading on CPU!
2023-09-15 17:08:35.435 | INFO | human_body_prior.tools.model_loader:load_model:97 - Loaded model in eval mode with trained weights: V02_05/snapshots/V02_05_epoch=13_val_loss=0.03.ckpt
/home/user/Desktop/smplify-x/smplifyx/optimizers/lbfgs_ls.py:238: UserWarning: This overload of add_ is deprecated:
add_(Number alpha, Tensor other)
Consider using one of the following signatures instead:
add_(Tensor other, *, Number alpha) (Triggered internally at ../torch/csrc/utils/python_arg_parser.cpp:1485.)
p.data.add_(step_size, update[offset:offset + numel].view_as(p.data))
Camera initialization done after 6.5344
Camera initialization final loss 1871.7843
Stage: 0%| | 0/5 [00:00<?, ?it/s]
Orientation: 0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in
main(**args)
File "smplifyx/main.py", line 245, in main
fit_single_frame(img, keypoints[[person_id]],
File "/home/user/Desktop/smplify-x/smplifyx/fit_single_frame.py", line 440, in fit_single_frame
final_loss_val = monitor.run_fitting(
File "/home/user/Desktop/smplify-x/smplifyx/fitting.py", line 174, in run_fitting
loss = optimizer.step(closure)
File "/home/user/.local/lib/python3.8/site-packages/torch/optim/optimizer.py", line 280, in wrapper
out = func(*args, **kwargs)
File "/home/user/Desktop/smplify-x/smplifyx/optimizers/lbfgs_ls.py", line 280, in step
orig_loss = closure()
File "/home/user/Desktop/smplify-x/smplifyx/fitting.py", line 241, in fitting_func
total_loss = loss(body_model_output, camera=camera,
File "/home/user/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/user/Desktop/smplify-x/smplifyx/fitting.py", line 366, in forward
weights = (joint_weights * joints_conf
RuntimeError: The size of tensor a (118) must match the size of tensor b (111) at non-singleton dimension 1

I meet with this runtime error problem, I have add --face and --hand option in openpose, and use_hands: True use_face: True in fit_smplx.yaml. I wonder how to solve this problem, thanks!

@Realinxc
Copy link

Realinxc commented Oct 8, 2023

Stage: 0%| | 0/5 [00:00<?, ?it/s]
Orientation: 0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in
main(**args)
File "smplifyx/main.py", line 245, in main
fit_single_frame(img, keypoints[[person_id]],
File "E:\MyCode\pythoncode\smplify-x\smplifyx\fit_single_frame.py", line 442, in fit_single_frame
final_loss_val = monitor.run_fitting(
File "E:\MyCode\pythoncode\smplify-x\smplifyx\fitting.py", line 176, in run_fitting
loss = optimizer.step(closure)
File "E:\Applications\tools\Anaconda\envs\smplx\lib\site-packages\torch\optim\optimizer.py", line 88, in wrapper
return func(*args, **kwargs)
File "E:\MyCode\pythoncode\smplify-x\smplifyx\optimizers\lbfgs_ls.py", line 280, in step
orig_loss = closure()
File "E:\MyCode\pythoncode\smplify-x\smplifyx\fitting.py", line 247, in fitting_func
total_loss = loss(body_model_output, camera=camera,
File "E:\Applications\tools\Anaconda\envs\smplx\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "E:\MyCode\pythoncode\smplify-x\smplifyx\fitting.py", line 374, in forward
weights = (joint_weights * joints_conf
RuntimeError: The size of tensor a (118) must match the size of tensor b (18) at non-singleton dimension 1

I meet a similar problem. Have you solved it yet? I hope to receive your help.

@Realinxc
Copy link

Realinxc commented Oct 8, 2023

I have solved it! you can set "--model_pose BODY_25" in openpose option.

@slatiec
Copy link

slatiec commented Oct 21, 2023

its seems I can only get the 25 pose keypoints from openpose. how can I get all 118 of them?

@Realinxc
Copy link

It depends on your openpose and smplx settings.

@sakuradash
Copy link

try this
tensor118 is body plus face plus hands
bin\OpenPoseDemo.exe --model_pose BODY_25 --face -hand --image_dir .\examples\media --write_json .\test

@BowenTan02
Copy link

try this tensor118 is body plus face plus hands bin\OpenPoseDemo.exe --model_pose BODY_25 --face -hand --image_dir .\examples\media --write_json .\test

I think OpenPose BODY_25 with face and hand requires >= 16GB of GPU... May I ask if you have used any Colab/Linux scripts for OpenPose? Thanks!

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

5 participants