basic test
This commit is contained in:
@@ -160,3 +160,4 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
.vscode/launch.json
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
os.environ["CUDA_VISIBLE_DEVICES"] = '6'
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from smpl_tf import SMPL
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
smpl_tf : SMPL = SMPL('model_files')
|
||||||
|
|
||||||
|
betas = np.zeros((1, 11), dtype=np.float32)
|
||||||
|
poses = np.zeros((1, 72), dtype=np.float32)
|
||||||
|
R = smpl_tf.run_rodrigues(poses)
|
||||||
|
posed = smpl_tf.run(R, betas)
|
||||||
|
|
||||||
|
|
||||||
|
pass
|
||||||
+6
-6
@@ -34,7 +34,7 @@ eval_joints = {
|
|||||||
|
|
||||||
class SMPL:
|
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.J_regressor = []
|
||||||
self.v_template = []
|
self.v_template = []
|
||||||
self.shapedirs = []
|
self.shapedirs = []
|
||||||
@@ -44,7 +44,7 @@ class SMPL:
|
|||||||
self.is_skirt = is_skirt
|
self.is_skirt = is_skirt
|
||||||
# Load SMPL models
|
# Load SMPL models
|
||||||
# path = os.path.abspath(os.path.dirname(__file__))
|
# 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:
|
if sys.version_info[0]<3:
|
||||||
female = pickle.load(f)
|
female = pickle.load(f)
|
||||||
else:
|
else:
|
||||||
@@ -54,7 +54,7 @@ class SMPL:
|
|||||||
self.posedirs.append(tf.constant(female['posedirs'], dtype=np.float32))
|
self.posedirs.append(tf.constant(female['posedirs'], dtype=np.float32))
|
||||||
self.shapedirs.append(tf.constant(female['shapedirs'], dtype=np.float32))
|
self.shapedirs.append(tf.constant(female['shapedirs'], dtype=np.float32))
|
||||||
self.weights.append(tf.constant(female['weights'], 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:
|
if sys.version_info[0]<3:
|
||||||
male = pickle.load(f)
|
male = pickle.load(f)
|
||||||
else:
|
else:
|
||||||
@@ -77,11 +77,11 @@ class SMPL:
|
|||||||
self.weights_one_hot = tf.one_hot(self.weights_one_hot, 24)
|
self.weights_one_hot = tf.one_hot(self.weights_one_hot, 24)
|
||||||
|
|
||||||
# Topology no head/hands/feet
|
# 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 = np.array(F['faces_default'])
|
||||||
self.f_skirt = np.array(F['faces_skirt'])
|
self.f_skirt = np.array(F['faces_skirt'])
|
||||||
self.nn = np.array(sio.loadmat('custom_utils/NN.mat'))
|
self.nn = np.array(sio.loadmat(os.path.join(path, 'NN.mat')))
|
||||||
self.to_keep = sio.loadmat(os.path.join('custom_utils/keep_remove.mat'))['keep'].reshape(-1)
|
self.to_keep = sio.loadmat(os.path.join(path, 'keep_remove.mat'))['keep'].reshape(-1)
|
||||||
|
|
||||||
self.weights_all = self.weights
|
self.weights_all = self.weights
|
||||||
if use_one_hot:
|
if use_one_hot:
|
||||||
|
|||||||
Reference in New Issue
Block a user