-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocess.py
More file actions
26 lines (25 loc) · 871 Bytes
/
preprocess.py
File metadata and controls
26 lines (25 loc) · 871 Bytes
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
import numpy as np
import pickle
import sys
import os
if __name__ == '__main__':
if len(sys.argv) < 2:
print('Error: expected source model path.')
exit(-1)
src_path = sys.argv[1]
with open(src_path, 'rb') as f:
src_data = pickle.load(f, encoding="latin1")
model = {
'J_regressor': src_data['J_regressor'],
'weights': np.array(src_data['weights']),
'posedirs': np.array(src_data['posedirs']),
'v_template': np.array(src_data['v_template']),
'shapedirs': np.array(src_data['shapedirs']),
'f': np.array(src_data['f']),
'kintree_table': src_data['kintree_table']
}
if 'cocoplus_regressor' in src_data.keys():
model['joint_regressor'] = src_data['cocoplus_regressor']
output_path = os.path.join('.', os.path.basename(src_path))
with open(output_path, 'wb') as f:
pickle.dump(model, f)