Beispiel #1
0
def create_network(window, input):
    network_first = create_regressor(batchsize=batchsize,
                                     window=window,
                                     input=input,
                                     dropout=0.0)
    network_second = create_core(batchsize=batchsize,
                                 window=window,
                                 dropout=0.0,
                                 depooler=lambda x, **kw: x / 2)
    network_second.load(np.load('network_core.npz'))
    network = Network(network_first,
                      network_second[1],
                      params=network_first.params)
    network.load(np.load('network_regression.npz'))
    return network_first, network_second, network
Beispiel #2
0
feet = np.array([9, 10, 11, 12, 13, 14, 21, 22, 23, 24, 25, 26])

Y = X[:, feet]

I = np.arange(len(X))
rng.shuffle(I)
X, Y = X[I], Y[I]

batchsize = 1
window = X.shape[2]

network_second = create_core(batchsize=batchsize,
                             window=window,
                             dropout=0.0,
                             depooler=lambda x, **kw: x / 2)
network_second.load(np.load('network_core.npz'))

network_first = create_regressor(batchsize=batchsize,
                                 window=window,
                                 input=Y.shape[1])
network = Network(network_first,
                  network_second[1],
                  params=network_first.params)

E = theano.shared(X, borrow=True)
F = theano.shared(Y, borrow=True)

trainer = AdamTrainer(rng=rng, batchsize=batchsize, epochs=100, alpha=0.00001)
trainer.train(network, F, E, filename='network_regression_kick.npz')
feet = np.array([27, 28, 29])
Y = X[:, feet]
print('X:', X)
print('Y: ', Y)
#Y shape: 121,12,240
#m.getch()
frames = np.hstack(np.arange(116, 125))
test = Y[:, :, frames]
test_gt = X[:, :, frames]
print('test:', test.shape)
batchsize = 1
window = test.shape[2]

network_first = create_regressor(batchsize=batchsize,
                                 window=window,
                                 input=test.shape[1],
                                 dropout=0.0)
network_second = create_core(batchsize=batchsize,
                             window=window,
                             dropout=0.0,
                             depooler=lambda x, **kw: x / 2)

#print('network_second[1]: ',network_second[0])
#print('network_second params: ',network_second.params)
#network_second.params=[W,b,W,b]
#print('after network_second')
network_second.load(np.load('network_core.npz'))
#print('after network_second load')
#print('network_second params: ',network_second.params)
#network_second.params=[W,b,W,b]
network = Network(network_first,
Beispiel #4
0
rng.shuffle(I)

data_train = data[I[:len(data) // 2]]
data_valid = data[I[len(data) // 2:]]

X = data_valid
X = np.swapaxes(X, 1, 2).astype(theano.config.floatX)

preprocess = np.load('preprocess_core.npz')
X = (X - preprocess['Xmean']) / preprocess['Xstd']
Y = X[:, -7:]

batchsize = 1

network_first = create_regressor(batchsize=batchsize,
                                 window=X.shape[2],
                                 input=Y.shape[1],
                                 dropout=0.0)
network_second = create_core(batchsize=batchsize,
                             window=X.shape[2],
                             dropout=0.0,
                             depooler=lambda x, **kw: x / 2)
network = Network(network_first,
                  network_second[1],
                  params=network_first.params)
network.load(np.load('network_regression.npz'))

from AnimationPlot import animation_plot

for i in range(5):

    index = rng.randint(len(X) - 1)