-
Notifications
You must be signed in to change notification settings - Fork 0
/
1DicLearning.py
42 lines (26 loc) · 1.01 KB
/
1DicLearning.py
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
import numpy as np
from sympy import *
from sympy.vector import CoordSys3D, gradient
import os
#import amc_parser
import scipy.io
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d as p3d
import spams
#import cvxpy as cvx
from datasets.datasetMat import CMUDataSet
# The coordinate system of poses3Ds:
# origin: (x_0,y_0,z_0) which present the mean value of all joint's coordinate (x,y,z)
# x Axis: vector point from left shoulder to right shoulder
# y Axis: vector point from midpoint of left and right shoulder to waist
# z Axis: the cross product of x Axis and y Axis
poses3Ds, scale3=CMUDataSet.getPose3DNormalized();
poses2Ds, scale2=CMUDataSet.getPose2DNormalized();
#
param = { 'K' : 200, 'lambda1' : 0.01, 'iter' :300}
#not the same result compared to authors original source code
B=spams.trainDL(np.asfortranarray(poses3Ds),**param)
init_pose = np.expand_dims(np.mean(poses3Ds, 1),axis=1);
print(init_pose.shape)
#
scipy.io.savemat('./datasets/BaseMatrix.mat', mdict={'init_pose':init_pose,'B':B})