所有用户请注意:应管局要求,请各位尽量将代码仓库设置为内部可见。管理员会巡查公开的代码仓库。

Verified Commit 391051e1 authored by Kiryuu Sakuya's avatar Kiryuu Sakuya 🎵
Browse files

Fix typo

parent f5fb10ab
import sys import sys
import tensorflow as tf import tensorflow as tf
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
sys.path.append('step3') sys.path.append('step3')
...@@ -85,5 +85,5 @@ with tf.Session() as sess: ...@@ -85,5 +85,5 @@ with tf.Session() as sess:
print('current accuracy: ', str(acc_v)) print('current accuracy: ', str(acc_v))
# if acc_v \u003e 0.7 and acc_v \u003e max_acc: # if acc_v \u003e 0.7 and acc_v \u003e max_acc:
# max_acc = acc_v # max_acc = acc_v
# saver.save(sess, \"step10/Model/FinalNet\") # saver.save(sess, "step10/Model/FinalNet")
#********** End **********# #********** End **********#
\ No newline at end of file
...@@ -80,5 +80,5 @@ with tf.Session() as sess: ...@@ -80,5 +80,5 @@ with tf.Session() as sess:
if acc_v \u003e 0.7 and acc_v \u003e max_acc: if acc_v \u003e 0.7 and acc_v \u003e max_acc:
max_acc = acc_v max_acc = acc_v
saver.save(sess, \"step10/Model/FinalNet\") saver.save(sess, "step10/Model/FinalNet")
...@@ -89,4 +89,4 @@ with tf.Session() as sess: ...@@ -89,4 +89,4 @@ with tf.Session() as sess:
if acc_v \u003e 0.7 and acc_v \u003e max_acc: if acc_v \u003e 0.7 and acc_v \u003e max_acc:
max_acc = acc_v max_acc = acc_v
saver.save(sess, \"step10/Model/FinalNet\") saver.save(sess, "step10/Model/FinalNet")
\ No newline at end of file \ No newline at end of file
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
......
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
...@@ -25,19 +25,19 @@ with tf.Session() as sess: ...@@ -25,19 +25,19 @@ with tf.Session() as sess:
# for op in graph.get_operations(): # for op in graph.get_operations():
# print(op.name) # print(op.name)
# mm = graph.get_tensor_by_name(\"batch_normalization/moving_mean:0\") # mm = graph.get_tensor_by_name("batch_normalization/moving_mean:0")
# print(sess.run(mm)) # print(sess.run(mm))
# exit() # exit()
G_Valid = batchGenerator(batchSize=8, basePath='data/processed/valid_224') G_Valid = batchGenerator(batchSize=8, basePath='data/processed/valid_224')
X_v, Y_v = G_Valid.getBatch() X_v, Y_v = G_Valid.getBatch()
batchImgInput = graph.get_tensor_by_name(\"batchImgInput:0\") batchImgInput = graph.get_tensor_by_name("batchImgInput:0")
labels = graph.get_tensor_by_name(\"Labels:0\") labels = graph.get_tensor_by_name("Labels:0")
keeProb = graph.get_tensor_by_name(\"dropout_keep_prob:0\") keeProb = graph.get_tensor_by_name("dropout_keep_prob:0")
try: try:
BNTraining = graph.get_tensor_by_name(\"BNTraining:0\") BNTraining = graph.get_tensor_by_name("BNTraining:0")
batchSize = graph.get_tensor_by_name(\"InputBatchSize:0\") batchSize = graph.get_tensor_by_name("InputBatchSize:0")
except: except:
BNTraining, batchSize = None, None BNTraining, batchSize = None, None
...@@ -52,7 +52,7 @@ with tf.Session() as sess: ...@@ -52,7 +52,7 @@ with tf.Session() as sess:
else: else:
feed_dict = {batchImgInput: X_v, labels: Y_v, keeProb: 1.} feed_dict = {batchImgInput: X_v, labels: Y_v, keeProb: 1.}
out = graph.get_tensor_by_name(\"model_outputs/BiasAdd:0\") out = graph.get_tensor_by_name("model_outputs/BiasAdd:0")
output_v = softmax( output_v = softmax(
sess.run(out, sess.run(out,
feed_dict=feed_dict)) feed_dict=feed_dict))
......
...@@ -11,7 +11,7 @@ class batchGenerator: ...@@ -11,7 +11,7 @@ class batchGenerator:
def __init__(self, basePath='data/processed/train_224/', batchSize=256): def __init__(self, basePath='data/processed/train_224/', batchSize=256):
''' '''
数据集中有四类图片分别是'bus','family sedan','fire engine','racing car', 数据集中有四类图片分别是'bus','family sedan','fire engine','racing car',
每个图片的文件名形式为\"XXX (id).jpg\"\"XXX (id)_flipx.jpg\",例如\"bus (1).jpg\",\"bus (1)_flipx.jpg\" 每个图片的文件名形式为"XXX (id).jpg"或"XXX (id)_flipx.jpg",例如"bus (1).jpg","bus (1)_flipx.jpg"
:param basePath:数据集路径 :param basePath:数据集路径
:param batchSize: 每次获取的图片数量 :param batchSize: 每次获取的图片数量
......
import tensorflow as tf import tensorflow as tf
import os import os
# os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' # os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
#----以下是答案部分 begin----# #----以下是答案部分 begin----#
# 定义placeholder 开始 # 定义placeholder 开始
...@@ -62,7 +62,7 @@ train = tf.train.AdamOptimizer().minimize(loss) ...@@ -62,7 +62,7 @@ train = tf.train.AdamOptimizer().minimize(loss)
with tf.Session() as sess: with tf.Session() as sess:
sess.run(tf.global_variables_initializer()) sess.run(tf.global_variables_initializer())
tf.train.export_meta_graph(filename=\"step4/modelInfo/AlexNet\", tf.train.export_meta_graph(filename="step4/modelInfo/AlexNet",
graph=tf.get_default_graph()) graph=tf.get_default_graph())
tf.reset_default_graph() tf.reset_default_graph()
\ No newline at end of file
...@@ -52,5 +52,5 @@ import tensorflow as tf ...@@ -52,5 +52,5 @@ import tensorflow as tf
#---否则影响测评---# #---否则影响测评---#
with tf.Session() as sess: with tf.Session() as sess:
sess.run(tf.global_variables_initializer()) sess.run(tf.global_variables_initializer())
tf.train.export_meta_graph(filename=\"step4/userModelInfo/AlexNet\", tf.train.export_meta_graph(filename="step4/userModelInfo/AlexNet",
graph=tf.get_default_graph()) graph=tf.get_default_graph())
\ No newline at end of file
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
......
...@@ -54,8 +54,8 @@ train = tf.train.AdamOptimizer().minimize(loss) ...@@ -54,8 +54,8 @@ train = tf.train.AdamOptimizer().minimize(loss)
with tf.Session() as sess: with tf.Session() as sess:
sess.run(tf.global_variables_initializer()) sess.run(tf.global_variables_initializer())
# saver.save(sess, \"modelInfo/VGGNet\") # saver.save(sess, "modelInfo/VGGNet")
tf.train.export_meta_graph(filename=\"step6/modelInfo/VGGNet\", tf.train.export_meta_graph(filename="step6/modelInfo/VGGNet",
graph=tf.get_default_graph()) graph=tf.get_default_graph())
tf.reset_default_graph() tf.reset_default_graph()
# if __name__ == '__main__': # if __name__ == '__main__':
......
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
......
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
......
import os import os
os.environ[\"TF_CPP_MIN_LOG_LEVEL\"]='3' os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment