boycehbz / MvSMPLfitting

A multi-view SMPL fitting based on smplify-x
MIT License
251 stars 28 forks source link

RuntimeError: size of dimension does not match previous size, operand 1, dim 2 #4

Open zhengshoujian opened 3 years ago

zhengshoujian commented 3 years ago

hello, when i run the code and got error above, could you give me the torch version that you used or did you got the same error before, could you tell me how to fix the bug? thanks a lot!

boycehbz commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

zhengshoujian commented 3 years ago

the problem is solved. and i find the output of just one image or multiview image as input,the output make no difference

发自我的iPhone

------------------ Original ------------------ From: boycehbz @.> Date: Sat,Mar 20,2021 7:18 PM To: boycehbz/MvSMPLfitting @.> Cc: zweistein @.>, Author @.> Subject: Re: [boycehbz/MvSMPLfitting] RuntimeError: size of dimension does not match previous size, operand 1, dim 2 (#4)

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

YananSunn commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

Hi, I met the same problem, and I ran the code on Ubuntu 18.04 with torch1.1.0 and 1.7.0 (My Cuda version is 11.0, which is compatible with 1.7.0). I have no idea how to fix the bug, could you offer some advice? Thanks a lot!

boycehbz commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

Hi, I met the same problem, and I ran the code on Ubuntu 18.04 with torch1.1.0 and 1.7.0 (My Cuda version is 11.0, which is compatible with 1.7.0). I have no idea how to fix the bug, could you offer some advice? Thanks a lot!

Can you provide more details on this problem?

YananSunn commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

Hi, I met the same problem, and I ran the code on Ubuntu 18.04 with torch1.1.0 and 1.7.0 (My Cuda version is 11.0, which is compatible with 1.7.0). I have no idea how to fix the bug, could you offer some advice? Thanks a lot!

Can you provide more details on this problem?

Sure, here is the error:

Traceback (most recent call last): File "code/main.py", line 86, in main(args) File "code/main.py", line 64, in main init_guess(setting, data, use_torso=True, args) File "/data/sunyn/MvSMPLfitting/code/utils/init_guess.py", line 27, in init_guess model_output = model(return_verts=True, return_full_pose=True, body_pose=init_pose) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/data/sunyn/MvSMPLfitting/code/smplx/body_models_scale.py", line 391, in forward self.lbs_weights, scale, dtype=self.dtype) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 179, in lbs v_shaped = v_template + blend_shapes(betas, shapedirs) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 265, in blend_shapes blend_shape = torch.einsum('bl,mkl->bmk', [betas, shape_disps]) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/functional.py", line 241, in einsum return torch._C._VariableFunctions.einsum(equation, operands) RuntimeError: size of dimension does not match previous size, operand 1, dim 2

Until now, I have tried the code on two different servers. Server 1: Ubuntu 18.04 with torch 1.1.0 and 1.7.0, the Cuda version is 11.0. Server 2: Ubuntu 16.04 with torch 1.4.0, the Cuda version is 10.1. All of them met the error above.

p.s. To run the code, I followed the steps below:

  1. git clone this repo
  2. download the three .pkl files, rename them and move them to the models/smpl
  3. replace the '\' with '/' in the code/utils/data_parser.py (Since my system is Linux, the path is a little different)
  4. run python code/main.py --config cfg_files/fit_smpl.yaml

If there are any details I didn't mention, please figure them out and I'll reply as soon as possible. Looking forward to your advice. Thanks a lot!

boycehbz commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

Hi, I met the same problem, and I ran the code on Ubuntu 18.04 with torch1.1.0 and 1.7.0 (My Cuda version is 11.0, which is compatible with 1.7.0). I have no idea how to fix the bug, could you offer some advice? Thanks a lot!

Can you provide more details on this problem?

Sure, here is the error:

Traceback (most recent call last): File "code/main.py", line 86, in main(args) File "code/main.py", line 64, in main init_guess(setting, data, use_torso=True, args) File "/data/sunyn/MvSMPLfitting/code/utils/init_guess.py", line 27, in init_guess model_output = model(return_verts=True, return_full_pose=True, body_pose=init_pose) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/data/sunyn/MvSMPLfitting/code/smplx/body_models_scale.py", line 391, in forward self.lbs_weights, scale, dtype=self.dtype) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 179, in lbs v_shaped = v_template + blend_shapes(betas, shapedirs) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 265, in blend_shapes blend_shape = torch.einsum('bl,mkl->bmk', [betas, shape_disps]) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/functional.py", line 241, in einsum return torch._C._VariableFunctions.einsum(equation, operands) RuntimeError: size of dimension does not match previous size, operand 1, dim 2

Until now, I have tried the code on two different servers. Server 1: Ubuntu 18.04 with torch 1.1.0 and 1.7.0, the Cuda version is 11.0. Server 2: Ubuntu 16.04 with torch 1.4.0, the Cuda version is 10.1. All of them met the error above.

p.s. To run the code, I followed the steps below:

  1. git clone this repo
  2. download the three .pkl files, rename them and move them to the models/smpl
  3. replace the '\' with '/' in the code/utils/data_parser.py (Since my system is Linux, the path is a little different)
  4. run python code/main.py --config cfg_files/fit_smpl.yaml

If there are any details I didn't mention, please figure them out and I'll reply as soon as possible. Looking forward to your advice. Thanks a lot!

The implementation of torch.einsum may be different in your PyTorch version. I have tried the code with Ubuntu 18.04 and torch 1.19.0. It works well on my platform. You can check the dimension of the two tensors in line 265, in '''code/smplx/lbs.py'''. The dimension of betas is [1,10] and shape_disps is [6890,3,10]

YananSunn commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

Hi, I met the same problem, and I ran the code on Ubuntu 18.04 with torch1.1.0 and 1.7.0 (My Cuda version is 11.0, which is compatible with 1.7.0). I have no idea how to fix the bug, could you offer some advice? Thanks a lot!

Can you provide more details on this problem?

Sure, here is the error: Traceback (most recent call last): File "code/main.py", line 86, in main(args) File "code/main.py", line 64, in main init_guess(setting, data, use_torso=True, args) File "/data/sunyn/MvSMPLfitting/code/utils/init_guess.py", line 27, in init_guess model_output = model(return_verts=True, return_full_pose=True, body_pose=init_pose) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/data/sunyn/MvSMPLfitting/code/smplx/body_models_scale.py", line 391, in forward self.lbs_weights, scale, dtype=self.dtype) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 179, in lbs v_shaped = v_template + blend_shapes(betas, shapedirs) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 265, in blend_shapes blend_shape = torch.einsum('bl,mkl->bmk', [betas, shape_disps]) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/functional.py", line 241, in einsum return torch._C._VariableFunctions.einsum(equation, operands) RuntimeError: size of dimension does not match previous size, operand 1, dim 2 Until now, I have tried the code on two different servers. Server 1: Ubuntu 18.04 with torch 1.1.0 and 1.7.0, the Cuda version is 11.0. Server 2: Ubuntu 16.04 with torch 1.4.0, the Cuda version is 10.1. All of them met the error above. p.s. To run the code, I followed the steps below:

  1. git clone this repo
  2. download the three .pkl files, rename them and move them to the models/smpl
  3. replace the '' with '/' in the code/utils/data_parser.py (Since my system is Linux, the path is a little different)
  4. run python code/main.py --config cfg_files/fit_smpl.yaml

If there are any details I didn't mention, please figure them out and I'll reply as soon as possible. Looking forward to your advice. Thanks a lot!

The implementation of torch.einsum may be different in your PyTorch version. I have tried the code with Ubuntu 18.04 and torch 1.19.0. It works well on my platform. You can check the dimension of the two tensors in line 265, in '''code/smplx/lbs.py'''. The dimension of betas is [1,10] and shape_disps is [6890,3,10]

Thanks for the dimension info, which helps a lot. I printed the dimension of the two tensors and found the shape_disps is [6890. 3, 300], which means I downloaded the wrong .pkl. At https://smpl.is.tue.mpg.de/downloads, there are three download links, https://psfiles.is.tuebingen.mpg.de/downloads/smpl/SMPL_python_v-1-0-0-zip, the first one is right but it only contains two .pkl files, the male and the female. To make the code run successfully, I changed the model_type and the gender in the config file. Now it works well! Thanks a lot for your help!

p.s. When I tried to run the code on my own data, I met another problem, I will open a new issue for it.

YananSunn commented 3 years ago

I run this code on Windows10 with torch1.1.0, 1.4.0, 1.7.0. It works well on my platform. You can check whether your environment matches the requirements.

Hi, I met the same problem, and I ran the code on Ubuntu 18.04 with torch1.1.0 and 1.7.0 (My Cuda version is 11.0, which is compatible with 1.7.0). I have no idea how to fix the bug, could you offer some advice? Thanks a lot!

Can you provide more details on this problem?

Sure, here is the error: Traceback (most recent call last): File "code/main.py", line 86, in main(args) File "code/main.py", line 64, in main init_guess(setting, data, use_torso=True, args) File "/data/sunyn/MvSMPLfitting/code/utils/init_guess.py", line 27, in init_guess model_output = model(return_verts=True, return_full_pose=True, body_pose=init_pose) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/data/sunyn/MvSMPLfitting/code/smplx/body_models_scale.py", line 391, in forward self.lbs_weights, scale, dtype=self.dtype) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 179, in lbs v_shaped = v_template + blend_shapes(betas, shapedirs) File "/data/sunyn/MvSMPLfitting/code/smplx/lbs.py", line 265, in blend_shapes blend_shape = torch.einsum('bl,mkl->bmk', [betas, shape_disps]) File "/data/sunyn/miniconda3/envs/MvSMPL/lib/python3.6/site-packages/torch/functional.py", line 241, in einsum return torch._C._VariableFunctions.einsum(equation, operands) RuntimeError: size of dimension does not match previous size, operand 1, dim 2 Until now, I have tried the code on two different servers. Server 1: Ubuntu 18.04 with torch 1.1.0 and 1.7.0, the Cuda version is 11.0. Server 2: Ubuntu 16.04 with torch 1.4.0, the Cuda version is 10.1. All of them met the error above. p.s. To run the code, I followed the steps below:

  1. git clone this repo
  2. download the three .pkl files, rename them and move them to the models/smpl
  3. replace the '' with '/' in the code/utils/data_parser.py (Since my system is Linux, the path is a little different)
  4. run python code/main.py --config cfg_files/fit_smpl.yaml

If there are any details I didn't mention, please figure them out and I'll reply as soon as possible. Looking forward to your advice. Thanks a lot!

The implementation of torch.einsum may be different in your PyTorch version. I have tried the code with Ubuntu 18.04 and torch 1.19.0. It works well on my platform. You can check the dimension of the two tensors in line 265, in '''code/smplx/lbs.py'''. The dimension of betas is [1,10] and shape_disps is [6890,3,10]

Thanks for the dimension info, which helps a lot. I printed the dimension of the two tensors and found the shape_disps is [6890. 3, 300], which means I downloaded the wrong .pkl. At https://smpl.is.tue.mpg.de/downloads, there are three download links, https://psfiles.is.tuebingen.mpg.de/downloads/smpl/SMPL_python_v-1-0-0-zip, the first one is right but it only contains two .pkl files, the male and the female. To make the code run successfully, I changed the model_type and the gender in the config file. Now it works well! Thanks a lot for your help!

p.s. When I tried to run the code on my own data, I met another problem, I will open a new issue for it.