之前在Ubuntu中做训练没问题,后来在win7中训练出现了以下问题。
环境:TensorFlow 1.5

NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for C://spyderwork//catanddog//logs//train//model.ckpt-14999

[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device=”/job:localhost/replica:0/task:0/device:CPU:0”](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

出现上述问题的位置:

 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)#出错在该地

restore()的API如下

  def restore(self, sess, save_path):"""Restores previously saved variables.This method runs the ops added by the constructor for restoring variables.It requires a session in which the graph was launched.  The variables torestore do not have to have been initialized, as restoring is itself a wayto initialize variables.The `save_path` argument is typically a value previously returned from a`save()` call, or a call to `latest_checkpoint()`.Args:sess: A `Session` to use to restore the parameters. None in eager mode.save_path: Path where parameters were previously saved.Raises:ValueError: If save_path is None."""if self._is_empty:returnif save_path is None:raise ValueError("Can't load save_path when it is None.")logging.info("Restoring parameters from %s", save_path)if context.in_graph_mode():sess.run(self.saver_def.restore_op_name,{self.saver_def.filename_tensor_name: save_path})else:self._build_eager(save_path, build_save=False, build_restore=True)

restore的save_path参数为先前保存checkpoint的地址—“Path where parameters were previously saved。
之前保存checkpoint的代码为:

checkpoint_path = os.path.join(logs_train_dir, 'model.ckpt')
saver.save(sess, checkpoint_path, global_step=step)

checkpoint打印出来的地址为C:/spyderwork/catanddog/logs/train/model.ckpt-14999
而ckpt.model_checkpoint_path打印出来为C://spyderwork//catanddog//logs//train//model.ckpt-14999

这一块不知道是TensorFlow在windows中的bug还是其他原因,所以会出现这类错误。
修改方法1:
将以下代码

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)#出错在该地

换成

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]checkpoint_path = os.path.join(logs_train_dir, 'model.ckpt')saver.restore(sess,checkpoint_path)

修改方法2:

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,'C:/spyderwork/catanddog/logs/train/model.ckpt-14999')或者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,'./logs/train/model.ckpt-14999')

注:修改时请根据自己的路径进行修改

[参考]https://github.com/tensorflow/tensorflow/issues/6082

NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for xxx相关推荐

  1. 导入训练好的模型参数代码报错Failed to find any matching files for ram://20787ba9-e8c3-4c71-a3b9-dc406d492e95/varia

    报错:Failed to find any matching files for ram://20787ba9-e8c3-4c71-a3b9-dc406d492e95/variables/variab ...

  2. Failed to find any matching files for /tmp/resnet_v1_50.ckpt

    直接说我的原因吧,地址不对,将/tmp/resnet_v1_50.ckpt中最前面的/去了,就行了 可以做一个测试 import os path = '/tmp/resnet_v1_50.ckpt'i ...

  3. 【Spring】Bean instantiation via constructor failed nested exception Constructor threw exception

    1.概述 我今天一个程序报错依赖异常.错误信息如下 Caused by:UnsatisfiedDependencyException: Error creating bean with name 'e ...

  4. Spyder:NotFoundError: Restoring from checkpoint failed.

    Tensorflow加载模型错误: NotFoundError: Restoring from checkpoint failed. This is most likely due to a Vari ...

  5. NotFoundError: Restoring from checkpoint failed. 解决

    遇到的问题: tensorflow版本:tensorflow1.13.1-gpu 今天在学习tensorflow的模型保存和载入中出现以下BUG NotFoundError: Restoring fr ...

  6. failed to get the task for process XXX(解决方案)

    引人: iOS真机调试程序,报如下错误信息: failed to get the task for process XXX 原因: 证书问题,project和targets的证书都必须是开发证书,AD ...

  7. it : Tmaster (hook declined) error: failed to push some refs to https://xxx/biluo/xxx.git

    To https:///biluo/xxx.git! [remote rejected] master -> master (hook declined) error: failed to pu ...

  8. 解决Failed to open .ini file C:\Users\xxx\.android\emu-update-last-check.ini for writing.

    文章目录 问题背景 解决措施 原因思考 问题背景 本人使用的是比较新的版本的 sdk,集成在 idea 中运行,本人的环境变量是通过配置 ANDROID_AVD_HOME 把 avd 设备专门放到一个 ...

  9. 菜鸟笔记--debian根文件系统启动时[FAILED] Failed to start Create Volatile Files and Directories.

    今天移植debian的根文件系统到开发板上,根文件系统启动时一堆红色报警,很扎眼. [FAILED] Failed to start Create Volatile Files and Directo ...

最新文章

  1. matplotlib散点图,圆
  2. android魅族轮播图,用angularjs模仿魅族官网的图片轮播功能
  3. 题目1164:旋转矩阵
  4. 【复杂系统迁移 .NET Core平台系列】之迁移项目工程
  5. [Unity] AnimationEvent 的 receiver 需要继承 Mono
  6. js获取对象数组中指定属性值对象_3分钟学会操作JavaScript内置对象,快来试试吧...
  7. matepad适配鸿蒙,消息称华为 MatePad2 搭载骁龙888 4G 华为鸿蒙OS计划适配高通平台...
  8. ubuntu下安装MySQL8.0
  9. oracle对象依赖关系图,Oracle concepts 学习笔记(4)——Schema对象间的依赖关系
  10. 如何在mysql查询结果集中得到记录行号_如何在MySQL查询结果集中得到记录行号...
  11. 一行python代码查找中文同义词(synonyms)
  12. matlab画圆函数
  13. Visio直角连接线增加直角拐弯
  14. CSR8610 入门操作(BlueSuite 2.6.2和CSRXX_ROM_ConfigTool_3.0.64使用)
  15. python ppt 图片_Python批量导出多个PPT\/PPTX文件中每个幻灯片为独立JPG图片
  16. 《后端从入门到熟悉-序言》
  17. 神经网络和算法的关系,神经网络的算法有哪些
  18. SaaS-HRM中的认证授权
  19. 经典力学、相对论、量子力学
  20. 一文解决浏览器跨域问题

热门文章

  1. Android IJKPlayer缓冲区设置以及播放一段时间出错解决方案
  2. Visual Studio代码中的多个游标[关闭]
  3. 如何在Docker容器中挂载主机目录
  4. vim和NERD树扩展 - 添加文件
  5. 如何编辑Subversion中已提交的日志消息?
  6. 如何有效地连接字符串
  7. mybatis 联查
  8. [图解]在输入框和文本框中获取和设置光标位置,以及选中文本和获取选中文本值的方法 --- 详解,兼容所有浏览器。...
  9. CentOS如何下载安装EPEL源
  10. storm从入门到放弃(一),storm介绍