在Tensorflow中重命名模型目录

时间:2017-09-23 20:03:26

标签: tensorflow tensorflow-gpu

我将模型目录从/ home / abcd / andrew_model_jul25_tif /重命名为/ home / abcd / andrew_model_sep22 /,其中包含相同的两个文件夹。当我运行python脚本时,它给了我以下错误:

Traceback (most recent call last):
  File "eval_on_full_image.py", line 127, in <module>
    tf.app.run()
  File "/home/abcd/virtualenvs/project/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "eval_on_full_image.py", line 119, in main
    do_eval_on_whole(model_dir, file, file[a:], output_dir)
  File "eval_on_full_image.py", line 51, in do_eval_on_whole
    saver.restore(sess,tf.train.latest_checkpoint(model_dir))
  File "/home/abcd/virtualenvs/project/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1602, in latest_checkpoint
    if file_io.get_matching_files(v2_path) or file_io.get_matching_files(
  File "/home/abcd/virtualenvs/project/local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 334, in get_matching_files
    compat.as_bytes(single_filename), status)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/abcd/virtualenvs/project/local/lib/python2.7/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: /home/abcd/andrew_model_jul25_tif/model

当我将文件夹的名称更改回andrew_model_jul25时,脚本工作正常。可以更改文件夹的名称有这样的效果吗?

我正在使用1.1.0版本的tf,并在GPU上运行它。

1 个答案:

答案 0 :(得分:1)

问题出现在这里:

saver.restore(sess,tf.train.latest_checkpoint(model_dir))

尝试更新model_dir变量的名称