From d6cde9afc25745a9a6f1a8593e7dd02b2c964100 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Wed, 8 Nov 2017 22:34:44 -0600 Subject: [PATCH 01/15] Update input_data.py --- 01 cats vs dogs/input_data.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/01 cats vs dogs/input_data.py b/01 cats vs dogs/input_data.py index 69f27f0..ef994f6 100644 --- a/01 cats vs dogs/input_data.py +++ b/01 cats vs dogs/input_data.py @@ -1,6 +1,11 @@ #By @Kevin Xu #kevin28520@gmail.com +# 11.08 2017 更新 +# 最近入驻了网易云课堂讲师,我的第一门课《使用亚马逊云计算训练深度学习模型》。 +# 有兴趣的同学可以学习交流。 +# * 我的网易云课堂主页: http://study.163.com/provider/400000000275062/index.htm + # 深度学习QQ群, 1群满): 153032765 # 2群:462661267 #The aim of this project is to use TensorFlow to process our own data. From cfb0297b25484c62d898c6c5be67ea5808f1b857 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Wed, 8 Nov 2017 22:35:22 -0600 Subject: [PATCH 02/15] Update cifar10.py --- 02 CIFAR10/cifar10.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/02 CIFAR10/cifar10.py b/02 CIFAR10/cifar10.py index 9bc8a7b..34cb988 100644 --- a/02 CIFAR10/cifar10.py +++ b/02 CIFAR10/cifar10.py @@ -1,6 +1,9 @@ -#By @Kevin Xu -#kevin28520@gmail.com -#Youtube: https://www.youtube.com/channel/UCVCSn4qQXTDAtGWpWAe4Plw +# 11.08 2017 更新 +# 最近入驻了网易云课堂讲师,我的第一门课《使用亚马逊云计算训练深度学习模型》。 +# 有兴趣的同学可以学习交流。 +# * 我的网易云课堂主页: http://study.163.com/provider/400000000275062/index.htm + + #Chinese weibo: http://bit.ly/2nAmOcO @@ -305,4 +308,4 @@ def evaluate(): - \ No newline at end of file + From ab942307eb3fec5c7982a32e92450f0bc10c2c64 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Wed, 8 Nov 2017 22:35:59 -0600 Subject: [PATCH 03/15] Update README.md --- 03 TFRecord/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/03 TFRecord/README.md b/03 TFRecord/README.md index e4d3639..ef66fbb 100644 --- a/03 TFRecord/README.md +++ b/03 TFRecord/README.md @@ -1,3 +1,9 @@ +# 11.08 2017 更新 +最近入驻了网易云课堂讲师,我的第一门课《使用亚马逊云计算训练深度学习模型》。 +有兴趣的同学可以学习交流。 +* 我的网易云课堂主页: http://study.163.com/provider/400000000275062/index.htm +--- + # How to transform our data into TFRecord? 1. transform data into TFRecord format 2. read TFRecord file From 71c1be404cee869e2868361c973bacee82e42c95 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Wed, 8 Nov 2017 22:37:06 -0600 Subject: [PATCH 04/15] Update readme.md --- 04 VGG Tensorflow/readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/04 VGG Tensorflow/readme.md b/04 VGG Tensorflow/readme.md index d71ac5d..ea8cb6e 100644 --- a/04 VGG Tensorflow/readme.md +++ b/04 VGG Tensorflow/readme.md @@ -1,3 +1,9 @@ +# 11.08 2017 更新 +最近入驻了网易云课堂讲师,我的第一门课《使用亚马逊云计算训练深度学习模型》。 +有兴趣的同学可以学习交流。 +* 我的网易云课堂主页: http://study.163.com/provider/400000000275062/index.htm +--- + # VGG with Tensorflow 1. VGG paper review From 0eae7696fdb5eb47de4a3e0f01e62bdd3811b7b7 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Wed, 8 Nov 2017 22:49:09 -0600 Subject: [PATCH 05/15] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4010d68..e304fb6 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ # My-TensorFlow-tutorials -1. This repo contains my computer vision projects. -2. My interests: - - computer vision - - deep learning +1. This repo contains Tensorflow & deep learning projects. # Where to find me (for Chinese readers)? -* Youtube: https://www.youtube.com/c/KevinXu (videos were recorded in Chinese, 中文视频) +*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm (第一时间更新在这里) +* Youtube: https://www.youtube.com/c/KevinXu * 微博: http://weibo.com/3983872447/profile * 优酷: http://i.youku.com/deeplearning101 * 深度学习QQ群: 153032765 (人满), 2群:462661267(人满), 3群:264976854 From 9339ce1f3342933e3d41217aed53afccf15f970f Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Thu, 9 Nov 2017 18:58:34 -0600 Subject: [PATCH 06/15] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index e304fb6..a072517 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,9 @@ 1. This repo contains Tensorflow & deep learning projects. # Where to find me (for Chinese readers)? -*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm (第一时间更新在这里) +*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm `第一时间更新在这里` * Youtube: https://www.youtube.com/c/KevinXu * 微博: http://weibo.com/3983872447/profile -* 优酷: http://i.youku.com/deeplearning101 * 深度学习QQ群: 153032765 (人满), 2群:462661267(人满), 3群:264976854 From 224029043e48538e3e8708a883570ad66f337a69 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Thu, 9 Nov 2017 18:58:59 -0600 Subject: [PATCH 07/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a072517..47ef3ed 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 1. This repo contains Tensorflow & deep learning projects. # Where to find me (for Chinese readers)? -*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm `第一时间更新在这里` +*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm `(第一时间更新在这里).` * Youtube: https://www.youtube.com/c/KevinXu * 微博: http://weibo.com/3983872447/profile * 深度学习QQ群: 153032765 (人满), 2群:462661267(人满), 3群:264976854 From 8d0cf8119c878a18a426a5b2f18e587260a9579a Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Fri, 17 Nov 2017 18:32:09 -0600 Subject: [PATCH 08/15] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 47ef3ed..8468d5a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # My-TensorFlow-tutorials -1. This repo contains Tensorflow & deep learning projects. +This repo contains Tensorflow & deep learning projects. +1. Deep Learning (as well as traditional Machine Learning, Data Mining). +2. Tensorflow, Keras # Where to find me (for Chinese readers)? *  网易云课堂:http://study.163.com/provider/400000000275062/index.htm `(第一时间更新在这里).` From 32b3dbf0fd848101e9855a0d2217be633b9177dd Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Sun, 14 Jan 2018 12:17:38 -0600 Subject: [PATCH 09/15] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8468d5a..f8e954a 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ This repo contains Tensorflow & deep learning projects. 2. Tensorflow, Keras # Where to find me (for Chinese readers)? -*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm `(第一时间更新在这里).` +*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm * Youtube: https://www.youtube.com/c/KevinXu * 微博: http://weibo.com/3983872447/profile -* 深度学习QQ群: 153032765 (人满), 2群:462661267(人满), 3群:264976854 +* 深度学习QQ群: 153032765 (人满), 2群:462661267(人满), 3群:264976854(人满),深度学习TF-4群:120983724 From fe013706953cbeb8713e35b27e23ea379afe4f52 Mon Sep 17 00:00:00 2001 From: hainingbaby Date: Mon, 11 Jun 2018 02:54:15 +0800 Subject: [PATCH 10/15] add evaluate_all_image() --- 01 cats vs dogs/training.py | 55 +++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/01 cats vs dogs/training.py b/01 cats vs dogs/training.py index decff16..8621183 100644 --- a/01 cats vs dogs/training.py +++ b/01 cats vs dogs/training.py @@ -161,8 +161,59 @@ def run_training(): # print('This is a cat with possibility %.6f' %prediction[:, 0]) # else: # print('This is a dog with possibility %.6f' %prediction[:, 1]) - - +# +def evaluate_all_image(): + ''' + Test all image against the saved models and parameters. + Return global accuracy of test_image_set + ############################################## + ##Notice that test image must has label to compare the prediction and real + ############################################## + ''' + # you need to change the directories to yours. + test_dir = '/home/kevin/tensorflow/cats_vs_dogs/data/test/' + N_CLASSES = 2 + print('-------------------------') + test, test_label = input_data.get_files(test_dir) + BATCH_SIZE = len(test) + print('There are %d test images totally..' % BATCH_SIZE) + print('-------------------------') + test_batch, test_label_batch = input_data.get_batch(test, + test_label, + IMG_W, + IMG_H, + BATCH_SIZE, + CAPACITY) + + logits = model.inference(test_batch, BATCH_SIZE, N_CLASSES) + testloss = model.losses(logits, test_label_batch) + testacc = model.evaluation(logits, test_label_batch) + + logs_train_dir = '/home/kevin/tensorflow/cats_vs_dogs/logs/train/' + saver = tf.train.Saver() + + with tf.Session() as sess: + print("Reading checkpoints...") + ckpt = tf.train.get_checkpoint_state(logs_train_dir) + if ckpt and ckpt.model_checkpoint_path: + global_step = ckpt.model_checkpoint_path.split('/')[-1].split('-')[-1] + saver.restore(sess, ckpt.model_checkpoint_path) + print('Loading success, global_step is %s' % global_step) + else: + print('No checkpoint file found') + print('-------------------------') + coord = tf.train.Coordinator() + threads = tf.train.start_queue_runners(sess=sess, coord=coord) + test_loss,test_acc = sess.run([testloss,testacc]) + print('The model\'s loss is %.2f' %test_loss) + correct = int(BATCH_SIZE*test_acc) + print('Correct : %d' % correct) + print('Wrong : %d' % (BATCH_SIZE - correct)) + print('The accuracy in test images are %.2f%%' %(test_acc*100.0)) + coord.request_stop() + coord.join(threads) + sess.close() + #%% From 9be14735cf56f7d30fd9446e037d0a76784f1643 Mon Sep 17 00:00:00 2001 From: Kevin Xu Date: Thu, 19 Jul 2018 19:47:35 -0500 Subject: [PATCH 11/15] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f8e954a..47c0c53 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +## (Note that this repo is NOT going to be updated anymore, tensorflow version used in this repo was very old. -- July 19th, 2018) + # My-TensorFlow-tutorials This repo contains Tensorflow & deep learning projects. 1. Deep Learning (as well as traditional Machine Learning, Data Mining). From 963d78f463da9d565ec1a2c1f31297b3c47c1543 Mon Sep 17 00:00:00 2001 From: Guoqing Xu Date: Sun, 27 Jan 2019 10:27:09 -0600 Subject: [PATCH 12/15] Update train_and_val.py --- 01 cats vs dogs/new_version/train_and_val.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01 cats vs dogs/new_version/train_and_val.py b/01 cats vs dogs/new_version/train_and_val.py index c22ec23..1e8daa8 100644 --- a/01 cats vs dogs/new_version/train_and_val.py +++ b/01 cats vs dogs/new_version/train_and_val.py @@ -69,7 +69,7 @@ def run_training(): x = tf.placeholder(tf.float32, shape=[BATCH_SIZE, IMG_W, IMG_H, 3]) - y_ = tf.placeholder(tf.int16, shape=[BATCH_SIZE]) + y_ = tf.placeholder(tf.int32, shape=[BATCH_SIZE]) logits = model.inference(x, BATCH_SIZE, N_CLASSES) loss = model.losses(logits, y_) From f0474342fdcb8dc24308c48eb368fc26b8303bde Mon Sep 17 00:00:00 2001 From: Guoqing Xu Date: Mon, 11 Mar 2019 10:34:36 -0500 Subject: [PATCH 13/15] add feed_dict to sess.run - add feed_dict to sess.run(summary_op) --- 04 VGG Tensorflow/training_and_val.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/04 VGG Tensorflow/training_and_val.py b/04 VGG Tensorflow/training_and_val.py index ff98148..bc49782 100644 --- a/04 VGG Tensorflow/training_and_val.py +++ b/04 VGG Tensorflow/training_and_val.py @@ -92,7 +92,7 @@ def train(): feed_dict={x:tra_images, y_:tra_labels}) if step % 50 == 0 or (step + 1) == MAX_STEP: print ('Step: %d, loss: %.4f, accuracy: %.4f%%' % (step, tra_loss, tra_acc)) - summary_str = sess.run(summary_op) + summary_str = sess.run(summary_op, feed_dict={x:tra_images, y_:tra_labels}) tra_summary_writer.add_summary(summary_str, step) if step % 200 == 0 or (step + 1) == MAX_STEP: @@ -101,7 +101,7 @@ def train(): feed_dict={x:val_images,y_:val_labels}) print('** Step %d, val loss = %.2f, val accuracy = %.2f%% **' %(step, val_loss, val_acc)) - summary_str = sess.run(summary_op) + summary_str = sess.run(summary_op, feed_dict={x:tra_images, y_:tra_labels}) val_summary_writer.add_summary(summary_str, step) if step % 2000 == 0 or (step + 1) == MAX_STEP: From 4552a82b9444256437d7b9144023e5a2195a9f1d Mon Sep 17 00:00:00 2001 From: Guoqing Xu Date: Mon, 11 Mar 2019 10:41:20 -0500 Subject: [PATCH 14/15] add feed_dict when executing sess.run(summary_op) - add feed_dict when executing sess.run(summary_op) --- 01 cats vs dogs/new_version/train_and_val.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/01 cats vs dogs/new_version/train_and_val.py b/01 cats vs dogs/new_version/train_and_val.py index 1e8daa8..74b989a 100644 --- a/01 cats vs dogs/new_version/train_and_val.py +++ b/01 cats vs dogs/new_version/train_and_val.py @@ -98,7 +98,7 @@ def run_training(): feed_dict={x:tra_images, y_:tra_labels}) if step % 50 == 0: print('Step %d, train loss = %.2f, train accuracy = %.2f%%' %(step, tra_loss, tra_acc*100.0)) - summary_str = sess.run(summary_op) + summary_str = sess.run(summary_op, feed_dict={x:tra_images, y_:tra_labels}) train_writer.add_summary(summary_str, step) if step % 200 == 0 or (step + 1) == MAX_STEP: @@ -106,7 +106,7 @@ def run_training(): val_loss, val_acc = sess.run([loss, acc], feed_dict={x:val_images, y_:val_labels}) print('** Step %d, val loss = %.2f, val accuracy = %.2f%% **' %(step, val_loss, val_acc*100.0)) - summary_str = sess.run(summary_op) + summary_str = sess.run(summary_op, feed_dict={x:tra_images, y_:tra_labels}) val_writer.add_summary(summary_str, step) if step % 2000 == 0 or (step + 1) == MAX_STEP: From 27163a33599e314cc15670dcabf6be2a0106f4a3 Mon Sep 17 00:00:00 2001 From: Guoqing Xu Date: Sat, 30 Mar 2019 22:13:12 -0500 Subject: [PATCH 15/15] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 47c0c53..be9bd9b 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,8 @@ This repo contains Tensorflow & deep learning projects. 1. Deep Learning (as well as traditional Machine Learning, Data Mining). 2. Tensorflow, Keras -# Where to find me (for Chinese readers)? -*  网易云课堂:http://study.163.com/provider/400000000275062/index.htm * Youtube: https://www.youtube.com/c/KevinXu -* 微博: http://weibo.com/3983872447/profile -* 深度学习QQ群: 153032765 (人满), 2群:462661267(人满), 3群:264976854(人满),深度学习TF-4群:120983724 +