2

我在 virtualenv 上安装并运行了 tf 1.8。我正在运行一个训练管道,该管道从 tfhub 加载 inception v3 并重新训练 softmax(与花朵示例几乎相同的工作流程(https://www.tensorflow.org/tutorials/image_retraining)。Tensorflow 集线器也安装在同一虚拟环境

这是我得到的错误。

INFO:tensorflow:Looking for images in 'moonflowers'
INFO:tensorflow:Looking for images in 'sunflowers'
INFO:tensorflow:Using /var/folders/z1/nty40mjd64b1xwvw_l1vhcs40000gn/T/tfhub_modules to cache modules.
Traceback (most recent call last):
  File "/Users/X/example_code/flower_trainer/imb_model.py", line 1355, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/Users/X/tensorflow/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "/Users/X/example_code/flower_trainer/imb_model.py", line 1039, in main
    module_spec = hub.load_module_spec(FLAGS.tfhub_module)
  File "/Users/X/tensorflow/lib/python3.6/site-packages/tensorflow_hub/native_module.py", line 103, in load_module_spec
    module_def_proto.ParseFromString(f.read())
  File "/Users/X/tensorflow/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 120, in read
    self._preread_check()
  File "/Users/X/tensorflow/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 80, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/Users/X/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 519, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /var/folders/z1/nty40mjd64b1xwvw_l1vhcs40000gn/T/tfhub_modules/11d9faf945d073033780fd924b2b09ff42155763/tfhub_module.pb; No such file or directory

任何人都遇到过类似的问题或对如何解决这个问题有任何指导?

4

1 回答 1

5

对我有用的解决方案:

删除 tfhub_modules 文件夹及其内容。在上面的追溯中,这将是:

/var/folders/z1/nty40mjd64b1xwvw_l1vhcs40000gn/T/tfhub_modules

其他系统可能会有所不同。对于我的设置是:

/var/folders/cc/0dttrmf90g777cws2m3sfvvr0000gp/T/tfhub_modules

然后重新运行 retrain.py

它将重新下载经过训练的网络,然后应该可以工作。

于 2018-06-26T08:22:20.073 回答