I make denoising autoencoder by tensorflow.
I use 799x161 matrix as input data.
here is my trainingg code
training_epochs = 100
batch_size = 799
display_step = 10
# Training
if do_train:
print ("Training Start")
for epoch in range(training_epochs):
avg_cost = 0.
num_batch = int(X_train.shape[0]/batch_size)
for i in range(num_batch):
batch = X_train[i*batch_size : i*batch_size+batch_size]
batch_noise = batch + 0.3*np.random.randn(batch.shape[0], 161) #addnoise
feed1 = {x: batch_noise, y_: batch, keep_prob: 0.5}
sess.run(optimizer, feed_dict = feed1)
feed2 = {x: batch_noise, y_: batch, keep_prob: 1}
avg_cost += sess.run(cost, feed_dict=feed2)/num_batch
if epoch % display_step == 0:
print ("Epoch: %03d/%03d cost: %.9f" % (epoch, training_epochs, avg_cost))
and test code
# TEST
testspeech = scipy.io.loadmat('data/test_cep.mat')
Y_test = testspeech['ans']
Y_test = np.array(Y_test) # 799x161 cepstrum matrix
noisyspeech = scipy.io.loadmat('data/reverb_cep.mat')
Y_noisy = noisyspeech['ans']
Y_noisy = np.array(Y_noisy) # 799x161 cepstrum addnoise matrix
batch = Y_test
batch_noise = Y_noisy
avg_cost += sess.run(cost, feed_dict=feed2)/num_batch
print ("cost: %.9f" % (avg_cost))
after test, i want to save output file as 799x161 matrix to compare with clean data and handle it in matlab.
My problem : But I don't know how to save it as matrix. I mean i want to save matrix as readable file in my PC. and i'm not sure matlab can read it.