NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for xxx
2018-02-05 10:35
3051 查看
之前在Ubuntu中做训练没问题,后来在win7中训练出现了以下问题。
环境:TensorFlow 1.5
restore()的API如下
”
restore的save_path参数为先前保存checkpoint的地址—“Path where parameters were previously saved。
之前保存checkpoint的代码为:
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:
将以下代码
换成
修改方法2:
注:修改时请根据自己的路径进行修改
[参考]https://github.com/tensorflow/tensorflow/issues/6082
环境: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 to restore do not have to have been initialized, as restoring is itself a way to 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: return if 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
相关文章推荐
- ] Not found: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for model
- Tensorflow :Unsuccessful TensorSliceReader constructor: Failed to find any matching files
- Unsuccessful TensorSliceReader constructor: Failed to get matching files
- iOS Failed to find matching arch for 64-bit Mach-O input file
- iOS Failed to find matching arch for 64-bit Mach-O input file
- Unable to find any test data conversion strategy for parameter with name ArrayList<XXX>
- Extjs 打包 failed to find any files
- No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt
- ios在真机上调试时出现“Error launching remote program: failed to get the task for process xxx"解决办法
- Failed to read artifact descriptor for xxx:jar
- ios在真机上调试时出现“Error launching remote program: failed to get the task for process xxx"解决办法(转)
- [xcode]Error launching remote program: failed to get the task for process xxx 本人解决办法
- Failed to find provider info for com.android.calendar问题排除
- 真机测试不能启动 --could not launch “xxx” process launch failed:failed to get the task for process 3306
- Failed to read artifact descriptor for xxx:jar
- android.os.NetworkOnMainThreadException,Failed to find provider info for com.android.inputmethod.lat
- Retrieving the COM class factory for component with CLSID {000209FF-XXX} failed due to the following error: 80070005 Access is denied.
- 真机调试Error launching remote program: failed to get the task for process xxx.
- Failed to read artifact descriptor for xxx:jar:版本号