Spaces:
Configuration error
Configuration error
File size: 1,181 Bytes
1ba539f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import os
import sys
import json
import numpy as np
import torch
sys.path.append("../")
from smplmodel.body_model import SMPLlayer
easymocap_params = json.load(open('zju_smpl/example.json'))[0]
poses = np.array(easymocap_params['poses'])
Rh = np.array(easymocap_params['Rh'])
Th = np.array(easymocap_params['Th'])
shapes = np.array(easymocap_params['shapes'])
# the params of neural body
params = {'poses': poses, 'Rh': Rh, 'Th': Th, 'shapes': shapes}
# np.save('params_0.npy', params)
# The newlly fitted SMPL parameters consider pose blend shapes.
new_params = True
## create smpl model
model_folder = 'data/zju_mocap/smplx'
device = torch.device('cpu')
body_model = SMPLlayer(os.path.join(model_folder, 'smpl'),
gender='neutral',
device=device,
regressor_path=os.path.join(model_folder,
'J_regressor_body25.npy'))
body_model.to(device)
## load SMPL zju
vertices = body_model(return_verts=True,
return_tensor=False,
new_params=new_params,
**params)
# np.save('vertices_0.npy', vertices)
|