Open minushuang opened 2 years ago
the length of pose_body_ids
of smpl is 69 according to the code inchmosh.py
, which is different from smplx 63
if cfg.surface_model.type == 'smpl':
pose_body_ids = all_pose_ids[3:] #69
elif cfg.surface_model.type == 'smplh':
pose_body_ids = all_pose_ids[3:66]
if cfg.moshpp.optimize_fingers: # dont chop chumpy variables two times
pose_finger_ids = all_pose_ids[66:]
elif cfg.surface_model.type == 'smplx': # orient:3, body:63, jaw:3, eyel:3, eyer:3, handl, handr
pose_body_ids = all_pose_ids[3:66]
modify the smpl pose_body_ids from
pose_body_ids = all_pose_ids[3:]
to
pose_body_ids = all_pose_ids[3:66]
is a temporary way for running the process but not the ultimate solution I think.
the problem is at the pose_body_prior.pkl
used inmoshpp.prior.gmm_prior_ch.py
, where the gmm['covars']
and gmm['means']
shapes are (8, 63, 63)
and (8,63)
respectively in the pkl file, so the npose=69
doesn't work when the model_surface_type
is smpl
.
npose = 63 if exclude_hands else 69
covars = gmm['covars'][:, :npose, :npose]
means = gmm['means'][:, :npose]
weights = gmm['weights']
the blender output mesh result is like #5 , the pose information is lost with correct shape and orientation.
Hi,
This is super helpful, and I am trying to recreate this currently. To my understanding, you downloaded the SMPL python model files, and then restructured them into the support_files/smpl
folder?
As part of this process, I renamed the SMPL pkl files from the original basicmodel_f_...
to model.pkl
to match the structure of smplx
. I then copied the pose_body_prior.pkl
file. My MoSh run is currently throwing an error since I don't have the corresponding model.npz
file for each body type. Is this file just derived from the pkl
file?
It seems the requisite .npz
files stem directly from the .pkl
files. The pkl
files for SMPL can be opened as per the guidance in this comment. Special care must be taken for the scipy sparse matrices. Here's some boilerplate code:
import pickle
import numpy
import scipy
with open('./support_files/smpl/male/model.pkl', 'rb') as f:
u = pickle._Unpickler(f)
u.encoding = 'latin1'
male_smpl_pkl = u.load()
# print(male_smpl_pkl)
npz = {}
for k,v in male_smpl_pkl.items():
if type(v) == np.ndarray:
npz[k] = v
elif type(v) == scipy.sparse.csc.csc_matrix:
npz[k] = v.todense().astype(np.float32)
else: # for strings and chumpy arrays
npz[k] = np.array(v)
np.savez('./support_files/smpl/male/model.npz', **npz)
the code can work normally when the model type is smplx. and now I try to fit the smpl params instead of the smplx following the smplx moshpp process. at first I donwloaded the smpl basic models, and put them under
support_files/smpl
directory, then change thesurface_model.type
from smplx to smpl, and addedopt_weights.smpl
config which is a copy of smplx as below.the error when I run the mosh job(task)