official doc of smplifyx & smplx
Environment:Win10 anaconda python3.7 CUDA11.1
1. Installation
pip install smplx[all]
git clone https://github.com/vchoutas/smplx
python setup.py install
Have to install for source code:
human-body-prior 2.1.2.0 (just download the default[master] branch)
mesh_intersection (fail but optional, that’s ok)
2. Summary of possible issues
Issue 1: numpy.core._exceptions.MemoryError: Unable to allocate 58.3 MiB for an array with shape (15272550,) and data type float32
Solution:Download the smplx_parts_segm.pkl, which has already been mentioned in smplifyx github.
Issue 2: model_ps_fname = model_ps_fname[0] IndexError: list index out of range
Processing: data\images\01_img.jpg
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in <module>
main(**args)
File "smplifyx/main.py", line 262, in main
**args)
File "E:\Graphics\bachelor_thesis\Code\smplify-x-master\smplifyx\fit_single_frame.py", line 193, in fit_single_frame
vposer, _ = load_model(vposer_ckpt, model_code=VPoser, remove_words_in_model_weights='vp_model.', disable_grad=True)
File "F:\Anaconda3\envs\python37\lib\site-packages\human_body_prior-2.1.2.0-py3.7.egg\human_body_prior\tools\model_loader.py", line 63, in load_model
model_ps, trained_weigths_fname = exprdir2model(expr_dir)
File "F:\Anaconda3\envs\python37\lib\site-packages\human_body_prior-2.1.2.0-py3.7.egg\human_body_prior\tools\model_loader.py", line 43, in exprdir2model
model_ps_fname = model_ps_fname[0]
IndexError: list index out of range
Solution:
# for linux version
# model_ps_fname = glob.glob(osp.join('/'.join(trained_weigths_fname.split('/')[:-2]), '*.yaml'))
# for windows version
model_ps_fname = glob.glob(osp.join('/'.join(trained_weigths_fname.split('\\')[:-2]), '*.yaml'))
Issue 3: KeyError: 'state_dict’
Processing: data\images\01_img.jpg
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in <module>
main(**args)
File "smplifyx/main.py", line 262, in main
**args)
File "E:\Graphics\bachelor_thesis\Code\smplify-x-master\smplifyx\fit_single_frame.py", line 193, in fit_single_frame
vposer, _ = load_model(vposer_ckpt, model_code=VPoser, remove_words_in_model_weights='vp_model.', disable_grad=True)
File "F:\Anaconda3\envs\python37\lib\site-packages\human_body_prior-2.1.2.0-py3.7.egg\human_body_prior\tools\model_loader.py", line 68, in load_model
state_dict = torch.load(trained_weigths_fname)['state_dict']
KeyError: 'state_dict'
Reason:
In vposer\snapshots folder, you need to have the corresponding version’s ckpt file. There is no key called state_dict in TR00_E096.pt
Solution:
For the version 2 of VPoser, we need to have V02_05_epoch=13_val_loss=0.03.ckpt and V02_05_epoch=08_val_loss=0.03.ckpt in this snapshot folder.
Issue 4: ModuleNotFoundError: No module named 'mesh_intersection’
ModuleNotFoundError: No module named 'mesh_intersection'
Solution:
Set interpenetration: False
in fix_smplx.yaml. I have searched the Internet for some time, however, currently I don’t find a suitable way to install mesh_intersection in Win10 & CUDA11.1.
Issue 5: TypeError: decode() got an unexpected keyword argument 'output_type’
Processing: data\images\01_img.jpg
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in <module>
main(**args)
File "smplifyx/main.py", line 262, in main
**args)
File "E:\Graphics\bachelor_thesis\Code\smplify-x-master\smplifyx\fit_single_frame.py", line 279, in fit_single_frame
focal_length=focal_length, dtype=dtype)
File "F:\Anaconda3\envs\python37\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "E:\Graphics\bachelor_thesis\Code\smplify-x-master\smplifyx\fitting.py", line 75, in guess_init
pose_embedding, output_type='aa').view(1, -1) if use_vposer else None
TypeError: decode() got an unexpected keyword argument 'output_type'
Solution:
Replace all the body_pose = vposer.decode(pose_embedding, output_type='aa').view(1, -1) if use_vposer else None
in fitting.py with body_pose = (vposer.decode(pose_embedding).get( 'pose_body')).reshape(1, -1) if use_vposer else None
. This replacement has already been mentioned in the issue#144 of smplifyx github.
# old version
# body_pose = vposer.decode(
# pose_embedding, output_type='aa').view(
# 1, -1) if use_vposer else None
# new version
body_pose = (vposer.decode(pose_embedding).get( 'pose_body')).reshape(1, -1) if use_vposer else None
Result
(python37) E:\Graphics\bachelor_thesis\Code\smplify-x-master>python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder data --output_folder output --visualize="True" --model_folder models --vposer_ckpt vposer --part_segm_fn smplx_parts_segm.pkl
Processing: data\images\01_img.jpg
E:\Graphics\bachelor_thesis\Code\smplify-x-master\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:1005.)
p.data.add_(step_size, update[offset:offset + numel].view_as(p.data))
Camera initialization done after 5.9239
Camera initialization final loss 3898.5735
Stage 000 done after 9.8382 seconds
Stage 001 done after 2.8174 seconds
Stage 002 done after 7.5401 seconds
Stage 003 done after 20.8577 seconds
Stage 004 done after 65.4517 seconds
Stage: 100%|████████████████████████████████████████████████████████████████████████| 5/5 [01:46<00:00, 21.33s/it]
Body fitting Orientation 0 done after 106.6352 seconds
Body final loss val = 10387.18945
Orientation: 100%|█████████████████████████████████████████████████████████████████| 1/1 [01:46<00:00, 106.64s/it]
Processing the data took: 00 hours, 02 minutes, 00 seconds
If you find this blog useful, please click the tumb or comment below. Free to discuss in English or Chinese. 😃