works but it need cleaning
This commit is contained in:
+14
-11
@@ -34,30 +34,33 @@ if __name__ == '__main__':
|
||||
|
||||
[yhat_delta_p, yhat_delta_q] = model.predict([x_angle, x_gyro, x_acc], batch_size=1, verbose=1)
|
||||
|
||||
layer_name = 'bidirectional_3'
|
||||
intermediate_layer_model = Model(inputs=model.input,
|
||||
outputs=model.get_layer(layer_name).output)
|
||||
intermediate_output = intermediate_layer_model.predict([x_angle, x_gyro, x_acc])
|
||||
#layer_name = 'dense_4'
|
||||
#intermediate_layer_model = Model(inputs=model.input,
|
||||
# outputs=model.get_layer(layer_name).output)
|
||||
#intermediate_output = intermediate_layer_model.predict([x_angle, x_gyro, x_acc])
|
||||
|
||||
|
||||
x_angle = np.array([x_angle])
|
||||
x_gyro = np.array([x_gyro])
|
||||
x_acc = np.array([x_acc])
|
||||
intermediate_output = np.array([intermediate_output])
|
||||
#intermediate_output = np.array([intermediate_output])
|
||||
|
||||
x_angle = x_angle.transpose(0, 3, 1, 2)
|
||||
x_gyro = x_gyro.transpose(0, 3, 1, 2)
|
||||
x_acc = x_acc.transpose(0, 3, 1, 2)
|
||||
intermediate_output = intermediate_output.transpose(0, 3, 1, 2)
|
||||
|
||||
#intermediate_output = intermediate_output.transpose(0, 3, 1, 2)
|
||||
#print("Aggregate:")
|
||||
#print(intermediate_output.tolist())
|
||||
|
||||
print("x0: ", np.shape(x_angle))
|
||||
print("out: ",np.shape(intermediate_output))
|
||||
#print("out: ",np.shape(intermediate_output))
|
||||
|
||||
x_angle = np.array(x_angle.flatten(), dtype=np.float32)
|
||||
x_gyro = np.array(x_gyro.flatten(), dtype=np.float32)
|
||||
x_acc = np.array(x_acc.flatten(), dtype=np.float32)
|
||||
yhat_delta_p = np.array(yhat_delta_p.flatten(), dtype=np.float32)
|
||||
yhat_delta_q = np.array(yhat_delta_q.flatten(), dtype=np.float32)
|
||||
intermediate_output = np.array(intermediate_output.flatten(), dtype=np.float32)
|
||||
#intermediate_output = np.array(intermediate_output.flatten(), dtype=np.float32)
|
||||
|
||||
|
||||
f = open("layers/input0.bin", mode='wb')
|
||||
@@ -70,6 +73,6 @@ if __name__ == '__main__':
|
||||
bin_write(f, yhat_delta_p)
|
||||
f = open("layers/output1.bin", mode='wb')
|
||||
bin_write(f, yhat_delta_q)
|
||||
f = open("layers/output.bin", mode='wb')
|
||||
bin_write(f, intermediate_output)
|
||||
#f = open("layers/output.bin", mode='wb')
|
||||
#bin_write(f, intermediate_output)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user