欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決tensorflow測(cè)試模型時(shí)NotFoundError錯(cuò)誤的問題

 更新時(shí)間:2018年07月27日 15:59:43   作者:John_kai  
今天小編就為大家分享一篇解決tensorflow測(cè)試模型時(shí)NotFoundError錯(cuò)誤的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

錯(cuò)誤代碼如下:

NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: 

Failed to find any matching files for xxx
……

經(jīng)查資料分析,錯(cuò)誤原因可能出在加載模型時(shí)的路徑問題。我采用的加載模型方法:

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')

在保存模型時(shí),采用的方法為

saver = tf.train.Saver()
……
……
……
if step % 1000 == 0 or (step + 1) == MAX_STEP:
 checkpoint_path = os.path.join(logs_train_dir, './model.ckpt')
 saver.save(sess, checkpoint_path, global_step=step)

注意代碼塊中的./model.ckpt,這是關(guān)鍵,原來為model.ckpt就會(huì)報(bào)錯(cuò)。如果在加載模型時(shí)采用直接加載模型文件的方法,則:

改之前代碼:

saver.restore(sess,'model.ckpt')

改之后的代碼:

saver.restore(sess,'./model.ckpt')

我的改之后是沒有什么問題了,如果這種方法不能解決你的問題,再查資料解決吧

以上這篇解決tensorflow測(cè)試模型時(shí)NotFoundError錯(cuò)誤的問題就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論