Spaces:
Build error
Build error
File size: 1,314 Bytes
d7a991a |
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 |
# Copyright (c) OpenMMLab. All rights reserved.
import os
import pickle
import numpy as np
from scipy.sparse import csc_matrix
def generate_smpl_weight_file(output_dir):
"""Generate a SMPL model weight file to initialize SMPL model, and generate
a 3D joints regressor file."""
if not os.path.exists(output_dir):
os.makedirs(output_dir)
joint_regressor_file = os.path.join(output_dir, 'test_joint_regressor.npy')
np.save(joint_regressor_file, np.zeros([24, 6890]))
test_data = {}
test_data['f'] = np.zeros([1, 3], dtype=np.int32)
test_data['J_regressor'] = csc_matrix(np.zeros([24, 6890]))
test_data['kintree_table'] = np.zeros([2, 24], dtype=np.uint32)
test_data['J'] = np.zeros([24, 3])
test_data['weights'] = np.zeros([6890, 24])
test_data['posedirs'] = np.zeros([6890, 3, 207])
test_data['v_template'] = np.zeros([6890, 3])
test_data['shapedirs'] = np.zeros([6890, 3, 10])
with open(os.path.join(output_dir, 'SMPL_NEUTRAL.pkl'), 'wb') as out_file:
pickle.dump(test_data, out_file)
with open(os.path.join(output_dir, 'SMPL_MALE.pkl'), 'wb') as out_file:
pickle.dump(test_data, out_file)
with open(os.path.join(output_dir, 'SMPL_FEMALE.pkl'), 'wb') as out_file:
pickle.dump(test_data, out_file)
return
|