解决tensorflow1.x版本加载saver.restore目录报错的问题
作者:风行水上cs 发布时间:2023-08-09 15:48:24
标签:tensorflow,加载,saver.restore
这个错误是最新的错误哈,目前只在tensorflow上的github仓库上面有提出,所以你在百度上面找不到。
是个tensorflow的bug十天前提出的,只有github仓库上一个地方有提出。
NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor:
Failed to find any matching files for xxx
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1022, in _do_call
return fn(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1004, in _run_fn
status, run_metadata)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\contextlib.py", line 66, in __exit__
next(self.gen)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for D://model.ckpt
[[Node: save_1/RestoreV2_10 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_10/tensor_names, save_1/RestoreV2_10/shape_and_slices)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:/DeepStock/DeepStock/testCapacity.py", line 77, in <module>
prediction(out)
File "F:/DeepStock/DeepStock/testCapacity.py", line 63, in prediction
saver.restore(sess, 'D://model.ckpt')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1428, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 767, in run
run_metadata_ptr)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 965, in _run
feed_dict_string, options, run_metadata)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1015, in _do_run
target_list, options, run_metadata)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1035, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for D://model.ckpt
[[Node: save_1/RestoreV2_10 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_10/tensor_names, save_1/RestoreV2_10/shape_and_slices)]]
Caused by op 'save_1/RestoreV2_10', defined at:
File "F:/DeepStock/DeepStock/testCapacity.py", line 77, in <module>
prediction(out)
File "F:/DeepStock/DeepStock/testCapacity.py", line 60, in prediction
saver = tf.train.Saver(tf.global_variables())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1040, in __init__
self.build()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1070, in build
restore_sequentially=self._restore_sequentially)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 675, in build
restore_sequentially, reshape)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 402, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 242, in restore_op
[spec.tensor.dtype])[0])
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 668, in restore_v2
dtypes=dtypes, name=name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 763, in apply_op
op_def=op_def)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2327, in create_op
original_op=self._default_original_op, op_def=op_def)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1226, in __init__
self._traceback = _extract_stack()
NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for D://model.ckpt
[[Node: save_1/RestoreV2_10 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_10/tensor_names, save_1/RestoreV2_10/shape_and_slices)]]
改之前代码:
saver.restore(sess, 'D://model.ckpt')
将前面加上个点斜杠就好了。
saver.restore(sess, 'D://./model.ckpt')
如果你目录太复杂实在搞不明白用这个(默认加载checkout 文件中的最新的保存的数据):
module_file = tf.train.latest_checkpoint('E://deeplearning-master/deeplearning-master/tensorflow-program/save/')
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
if module_file is not None:
saver.restore(sess, module_file)
来源:https://blog.csdn.net/u014283248/article/details/64440019


猜你喜欢
- 目录1.列表的介绍2.打印出列表的数据1.我们可以根据下标取值进行打印2.使用for循环遍历3.使用while循环遍历3.列表的添加操作1.
- 在修改后的 《闲谈 Web 图片服务器》 一文中也提及了"IE 浏览器的连接数问题",这也是个有趣的话题。值得补充记录一
- 之前的文章讲过用Tensorflow的object detection api训练MobileNetV2-SSDLite,然后发现训练的时候
- 复制表结构及其数据下面这个语句会拷贝数据到新表中。注意:这个语句其实只是把select语句的结果建一个表,所以新表不会有主键,索引。crea
- python有很多有趣的库,其中wxpy是连接微信的接口,具体可以查看官方文档。可以实现自动操作,wxpy 支持 Python 3.4-3.
- 创建新项目,及应用django-admin startproject myprojcd myprojpython manage.py sta
- 大家好!我是 Sergey Kamardin,是 Mail.Ru 的一名工程师。本文主要介绍如何使用 Go 开发高负载的 WebSocket
- 代码如下:create table A_TEST ( PAYOUT_ITEM_CODE VARCHAR2(30) not null, FOR
- 今天项目经理刚交给一个活儿,要我实现这样一个功能:要实现的是验证码文本框变窄一点,然后右边加入一副验证码图片,并且在响应式布局的情况下在移动
- tensorflow中的conv2有padding=‘SAME'这个参数。吴恩达讲课中说到当padding=(f-1)/2(f为卷积
- 本文实例为大家分享了微信小程序支付前端源码,供大家参考,具体内容如下//index.jsPage({ data: {}, //点击支付按钮进
- 在编程中我们往往会希望能够实现这样的操作:点击Button,选择了图片,然后在窗口中的Label处显示选到的图片。那么这时候就需要如下代码:
- 从小的方面讲,帮助一般是指:手册、说明书、文档、FAQ 等等。从大的方面讲,可以是交互过程中的提示、指引、演示等信息,帮助无处不在!这一切,
- 最近一直在用TF做CNN的图像分类,当softmax层得到预测结果后,我希望能够看到预测结果,以便和标签之间进行比较。特此补上,以便自己记忆
- 我就废话不多说了,直接上代码吧!from os import listdirimport osfrom time import timeim
- 今天在学习的时候,发现scipy.misc中的imread提取图片的方法被弃用了。太生气了!只好使用了matplotlib.pyplot中的
- 什么是pyQt5首先我们来说说什么是pyQt5。搞过GUI界面设计的童鞋一定都了解过微软的MFC。当然了,个人感觉MFC不是一个非常优雅的U
- linux安装mysql服务分两种安装方法:①源码安装,优点是安装包比较小,只有十多M,缺点是安装依赖的库多,安装编译时间长,安装步骤复杂容
- class Node: def __init__(self,dataval=None): self.d
- 遇到的问题当时自己在使用Alexnet训练图像分类问题时,会出现损失在一个epoch中增加,换做下一个epoch时loss会骤然降低,一开始