basic test

This commit is contained in:
2023-02-03 11:35:48 +00:00
parent 104a892e15
commit ceadca02e3
4 changed files with 24 additions and 6 deletions
+6 -6
View File
@@ -34,7 +34,7 @@ eval_joints = {
class SMPL:
def __init__(self, orig_smpl=False, use_one_hot=False, is_skirt=False):
def __init__(self, path, orig_smpl=False, use_one_hot=False, is_skirt=False):
self.J_regressor = []
self.v_template = []
self.shapedirs = []
@@ -44,7 +44,7 @@ class SMPL:
self.is_skirt = is_skirt
# Load SMPL models
# path = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join('custom_utils/super_model_f.pkl'), 'rb') as f:
with open(os.path.join(path, 'super_model_f.pkl'), 'rb') as f:
if sys.version_info[0]<3:
female = pickle.load(f)
else:
@@ -54,7 +54,7 @@ class SMPL:
self.posedirs.append(tf.constant(female['posedirs'], dtype=np.float32))
self.shapedirs.append(tf.constant(female['shapedirs'], dtype=np.float32))
self.weights.append(tf.constant(female['weights'], dtype=np.float32))
with open(os.path.join('custom_utils/super_model_m.pkl'), 'rb') as f:
with open(os.path.join(path, 'super_model_m.pkl'), 'rb') as f:
if sys.version_info[0]<3:
male = pickle.load(f)
else:
@@ -77,11 +77,11 @@ class SMPL:
self.weights_one_hot = tf.one_hot(self.weights_one_hot, 24)
# Topology no head/hands/feet
F = sio.loadmat('custom_utils/ssmpl_faces.mat')
F = sio.loadmat(os.path.join(path, 'ssmpl_faces.mat'))
self.f = np.array(F['faces_default'])
self.f_skirt = np.array(F['faces_skirt'])
self.nn = np.array(sio.loadmat('custom_utils/NN.mat'))
self.to_keep = sio.loadmat(os.path.join('custom_utils/keep_remove.mat'))['keep'].reshape(-1)
self.nn = np.array(sio.loadmat(os.path.join(path, 'NN.mat')))
self.to_keep = sio.loadmat(os.path.join(path, 'keep_remove.mat'))['keep'].reshape(-1)
self.weights_all = self.weights
if use_one_hot: