body-model-visualizer icon indicating copy to clipboard operation
body-model-visualizer copied to clipboard

How to use saved .pkl parameters file?

Open Ruid6 opened this issue 3 years ago • 1 comments

I have modified the smpl model and saved the pkl file,but i not load it in SMPL code. `def ready_arguments(fname_or_dict):

if not isinstance(fname_or_dict, dict):
    #dd = pickle.load(open(fname_or_dict))
    dd = pickle.load(open(fname_or_dict,"rb"),encoding='iso-8859-1')
else:
    dd = fname_or_dict
    
backwards_compatibility_replacements(dd) `

UnpicklingError invalid load key, '\x27'. File "/home/lrd/data/lrd/body-model-visualizer-filer/SMPL_python_v.1.1.0/smpl/smpl_webuser/serialization.py", line 81, in ready_arguments dd = pickle.load(open(fname_or_dict,"rb"),encoding='iso-8859-1') File "/home/lrd/data/lrd/body-model-visualizer-filer/SMPL_python_v.1.1.0/smpl/smpl_webuser/serialization.py", line 117, in load_model dd = ready_arguments(fname_or_dict) File "/home/lrd/data/lrd/body-model-visualizer-filer/SMPL_python_v.1.1.0/smpl/smpl_webuser/hello_world/hello_smpl.py", line 48, in <module> m = load_model( '/home/lrd/data/lrd/body-model-visualizer-filer/abc.pkl' )

sometimes,it is other error. I don't konw how to use this saved parameters.

Ruid6 avatar Aug 04 '22 12:08 Ruid6

You can use joblib to read the parameters.

` import joblib

with open('param_file_path', 'rb') as f: data = joblib.load(f) print(data) `

woo1 avatar Feb 19 '25 02:02 woo1