vchoutas / smplx

SMPL-X
https://smpl-x.is.tue.mpg.de/
Other
1.78k stars 303 forks source link

SMPL-H merge_smplh_mano.py error #107

Open gngdb opened 2 years ago

gngdb commented 2 years ago

After downloading the SMPL-H and MANO .pkl files I tried to merge_smplh_mano.py to create the required .npz files.

> python tools/merge_smplh_mano.py --smplh-fn models/smplh_raw/female/model.npz --mano-left-fn models/mano/MANO_LEFT.pkl --mano-right-fn models/mano/MANO_RIGHT.pkl --output-folder models/smplh
Traceback (most recent call last):
  File "tools/merge_smplh_mano.py", line 89, in <module>
    merge_models(smplh_fn, mano_left_fn, mano_right_fn, output_folder)
  File "tools/merge_smplh_mano.py", line 33, in merge_models
    body_data = pickle.load(body_file)
_pickle.UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.

I can't find much information about this error online. I think it might be something to do with PyTorch version.

gngdb commented 2 years ago

Oh, actually those SMPL-H files are already .npz obviously models/smplh_raw/female/model.npz. Does that mean they don't need to be merged with this tool?

gngdb commented 2 years ago

The error above comes from trying to open a .npz file as a .pkl. It seems like they do still need to be merged however. I was able to get it to merge by editing merge_smplh_mano.py to open an .npz. Here's what I ended up with: https://gist.github.com/gngdb/ac9084c254c5f29816da490d4f387d63

I can't verify that I'm producing exactly the right file though. I had to cast the output_data variable to be a dictionary because in the original code .copy() was called on whatever was loaded from the pickle file. I'm not sure what class that object would be because .copy() is not supported as a method on the standard Python datatypes as far as I know but it is a method that's supported by numpy arrays. But, numpy arrays' __getitem__ doesn't support strings. It's interacted with in a similar way to a dictionary though so it seemed to make sense.

gngdb commented 2 years ago

Also, if it's supposed to be an .npz file, why is it listed as a .pkl file in this section of the wiki? https://github.com/vchoutas/smplx/blob/master/README.md#model-loading