Переменная Tensorflow / ключ графика отсутствуют при перезагрузке модели в Python 3.6 - PullRequest
0 голосов
/ 02 ноября 2018

СООБЩЕНИЕ ОБ ОШИБКЕ:

NotFoundError: Ошибка восстановления с контрольной точки. Скорее всего, это связано с отсутствием в контрольной точке имени переменной или другого ключа графика. Пожалуйста, убедитесь, что вы не изменили ожидаемый график на основе контрольной точки. Исходная ошибка:

""" PLACEHOLDER """
x=tf.placeholder(tf.float32,shape=[None,784])
y_true=tf.placeholder(tf.float32,shape=[None,4])


Weight=tf.global_variables()
bias=tf.global_variables()

""" LAYERS:"""

"the image input layer 28*28 input"
x_image = tf.reshape(x,[-1,28,28,1])

"""first convolution, using 6*6 filter, and then max pooling 2by2, final 
output will have depth 32
here we are calculating 32 features
"""
convo_1 = convolutional_layer(x_image,shape=[6,6,1,32])
convo_1_pooling = max_pool_2by2(convo_1)

"""first convolution, using 6*6 filter, and then max pooling 2by2, final 
output will have 64
features hence depth 64
"""
convo_2 = convolutional_layer(convo_1_pooling,shape=[6,6,32,64])
convo_2_pooling = max_pool_2by2(convo_2)

"flattening the output of the last pooling layer to fuly connect it"
convo_2_flat = tf.reshape(convo_2_pooling,[-1,7*7*64])
Wt,bs=normal_full_layer(convo_2_flat,1024)#1024 nodes in the final layer

full_layer_one = tf.nn.relu(tf.matmul(convo_2_flat,Wt)+bs)

# NOTE THE PLACEHOLDER HERE!
hold_prob = tf.placeholder(tf.float32)
full_one_dropout = tf.nn.dropout(full_layer_one,keep_prob=hold_prob) 

Weight, bias= normal_full_layer(full_one_dropout,2)

y_pred=tf.matmul(full_one_dropout,Weight)+bias

"""INITIALIZE VARIABLES"""
init = tf.global_variables_initializer()

"""Add ops to save and restore all the variables"""
saver = tf.train.Saver()

"""Later, launch the model, use the saver to restore variables from disk, 
and
# do some work with the model"""

with tf.Session() as sess:
   # Restore variables from disk.
   saver.restore(sess,SAVE_PATH)
   print("Model restored.")

1 Ответ

0 голосов
/ 15 марта 2019

Если вы используете spyder, пожалуйста, перезагрузите ядро! Это может хорошо работать.

https://i.stack.imgur.com/R7w58.png

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...