From 3c184ec343b99cc9c4ce813ef8b081ec9f5fd426 Mon Sep 17 00:00:00 2001 From: Phu Sakulwongtana Date: Wed, 27 Sep 2017 18:11:22 +0100 Subject: [PATCH 1/3] Add folder creation --- ConvolutionalNeuralNetwork.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ConvolutionalNeuralNetwork.py b/ConvolutionalNeuralNetwork.py index 4c1ed9d..e11c842 100644 --- a/ConvolutionalNeuralNetwork.py +++ b/ConvolutionalNeuralNetwork.py @@ -1,5 +1,6 @@ import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data +import os mnist = input_data.read_data_sets("../MNIST_data/", one_hot=True) @@ -35,6 +36,10 @@ # ---------------------------------------- +if os.path.exists("saveCNN"): + os.makedirs("saveCNN") + + with tf.variable_scope("Input"): X = tf.placeholder(tf.float32, shape=[None, input_size]) input_conv = tf.reshape(X, [-1, image_size, image_size, channel_size]) @@ -143,7 +148,7 @@ if epoch % 100 == 0: print("Saving the model.") - save_path = saver.save(sess, "../saveCNN/trained_model" + str(epoch) + ".ckpt") + save_path = saver.save(sess, "/saveCNN/trained_model" + str(epoch) + ".ckpt") final_accuracy = sess.run(accuracy, feed_dict={X: mnist.test.images, Y: mnist.test.labels}) From d537e16501ed437f6cbe6d33070c6f504a450ce5 Mon Sep 17 00:00:00 2001 From: Phu Sakulwongtana Date: Wed, 27 Sep 2017 18:14:47 +0100 Subject: [PATCH 2/3] FloydHub File and fix bugs --- .floydexpt | 1 + .floydignore | 14 ++++++++++++++ ConvolutionalNeuralNetwork.py | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .floydexpt create mode 100644 .floydignore diff --git a/.floydexpt b/.floydexpt new file mode 100644 index 0000000..398db57 --- /dev/null +++ b/.floydexpt @@ -0,0 +1 @@ +{"name": "cnn-test-visualized", "family_id": "qNGVhmKB7MjGF7oh6KSFPc"} \ No newline at end of file diff --git a/.floydignore b/.floydignore new file mode 100644 index 0000000..02f9be9 --- /dev/null +++ b/.floydignore @@ -0,0 +1,14 @@ + +# Directories and files to ignore when uploading code to floyd + +.git +.eggs +eggs +lib +lib64 +parts +sdist +var +*.pyc +*.swp +.DS_Store diff --git a/ConvolutionalNeuralNetwork.py b/ConvolutionalNeuralNetwork.py index e11c842..1fc2fa2 100644 --- a/ConvolutionalNeuralNetwork.py +++ b/ConvolutionalNeuralNetwork.py @@ -36,7 +36,7 @@ # ---------------------------------------- -if os.path.exists("saveCNN"): +if not os.path.exists("saveCNN"): os.makedirs("saveCNN") From b4fdc00ef591b8351d26dd7f873189d441069955 Mon Sep 17 00:00:00 2001 From: Phu Sakulwongtana Date: Wed, 27 Sep 2017 18:39:20 +0100 Subject: [PATCH 3/3] Minor Bugs Fix --- ConvolutionalNeuralNetwork.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ConvolutionalNeuralNetwork.py b/ConvolutionalNeuralNetwork.py index 1fc2fa2..2385377 100644 --- a/ConvolutionalNeuralNetwork.py +++ b/ConvolutionalNeuralNetwork.py @@ -36,10 +36,6 @@ # ---------------------------------------- -if not os.path.exists("saveCNN"): - os.makedirs("saveCNN") - - with tf.variable_scope("Input"): X = tf.placeholder(tf.float32, shape=[None, input_size]) input_conv = tf.reshape(X, [-1, image_size, image_size, channel_size]) @@ -121,9 +117,9 @@ with tf.Session() as sess: sess.run(tf.global_variables_initializer()) - training_writer = tf.summary.FileWriter("../LogsCNN/training", sess.graph) - testing_writer = tf.summary.FileWriter("../LogsCNN/testing", sess.graph) - accuracy_writer = tf.summary.FileWriter("../LogsCNN/accuracy", sess.graph) + training_writer = tf.summary.FileWriter("/output/training_log", sess.graph) + testing_writer = tf.summary.FileWriter("/output/testing_log", sess.graph) + accuracy_writer = tf.summary.FileWriter("/output/accuracy_log", sess.graph) for epoch in range(training_epochs): train_batch_data, train_batch_labels = mnist.train.next_batch(batch_size) @@ -148,7 +144,7 @@ if epoch % 100 == 0: print("Saving the model.") - save_path = saver.save(sess, "/saveCNN/trained_model" + str(epoch) + ".ckpt") + save_path = saver.save(sess, "/output/trained_model" + str(epoch) + ".ckpt") final_accuracy = sess.run(accuracy, feed_dict={X: mnist.test.images, Y: mnist.test.labels})