smplx
smplx copied to clipboard
Convert SMPL-X to SMPL
Hi thanks for the code! I tried to convert an SMPL-x model (.obj generated by blender add-on) to a SMPL representation. While trying to run this code python main.py --exp-cfg config_files/smplx2smpl.yaml
, I met several problems.
-
I could not find the main.py scripts inside the project. Does it actually mean the
__main__.py
under transfer_model folder? If so, is there any specific reasons for naming it that way? -
I am not sure under which folder to run this command. Specifically, if I ran this command under the root smplx folder, then it should be
python transfer_model/__main__.py
; if ran under the transfer_model directory, the config_files is actually in its parent directory and the path cannot be found usingconfig_files/smplx2smpl.yaml
. -
Basically the similar problem as in 2, since I am not sure about where to run the command, there are many relative imports that cannot work, and continuously produces this error
ImportError: attempted relative import with no known parent package
Thank you for taking time to solve our problems in advance!
Best
I tried to make one sample case working by starting with the sample configuration in smplx2smpl.yaml
. By converting SMPL-X to SMPL, specifically, how should we specify the source model .obj and the output directory? I see here the building_layer function is trying to get the model type out of a path string. By using the default setting I got model_path=transfer_data/body_models
, since in smplx2smpl.yaml
, the folder of body_model is specified as transfer_data/body_models
. By running the provided default sample setting, the model type was extracted to be "body" which does not belong to the SMPL family.
Traceback (most recent call last): File "main.py", line 100, in
main() File "main.py", line 54, in main body_model = build_layer(model_path, **exp_cfg.body_model) File "/home/hengtao/anaconda3/lib/python3.8/site-packages/smplx/body_models.py", line 2345, in build_layer raise ValueError(f'Unknown model type {model_type}, exiting!') ValueError: Unknown model type body, exiting!
I would really appreciate the help in my issues. It would be great if I can have one case running smoothly, then I can read along the codes to have a better understanding of this excellent work. Thank you so much for the time!
There is a typo in documentation for SMPL-X to SMPL
. You should run python -m transfer_model --exp-cfg config_files/smplx2smpl.yaml
(instead of python main.py --exp-cfg config_files/smplx2smpl.yaml
) from root repository directory.
SMPL-X meshes must be in
transfer_data
├── meshes
│ ├── smpl
│ ├── smplx # <-- HERE
│ ├──----- mesh1.obj
│ ├──----- mesh2.obj
│ ├──----- ...
├── smpl2smplh_def_transfer.pkl
├── smpl2smplx_deftrafo_setup.pkl
├── smplh2smpl_def_transfer.pkl
├── smplh2smplx_deftrafo_setup.pkl
├── smplx2smpl_deftrafo_setup.pkl
├── smplx2smplh_deftrafo_setup.pkl
├── smplx_mask_ids.npy
According to build_layer
, if model_path
is not a directory (which includes the case of doesn't exist), it will extract the first word separated by _
as model_type
. To avoid the error, I copied SMPL_NEUTRAL.pkl
to models/smpl
and set body_model.folder
to be models
. (models
is directly under the working directory)
I've managed to use this code (after making some edits in my fork) to convert between SMPL-H and SMPL-X using the AMASS sample data. It seems to have worked. My notes are here, including the exact sequence of commands I ran.
If I have time I'll implement a conversion script that doesn't require these multiple steps. Writing the .obj
files is a trivial step so it seems unnecessary to make the user do it manually.