tensorflow对象检测API错误训练

时间:2018-04-20 07:35:07

标签: python tensorflow deep-learning object-detection

我正在使用UBUNTU 16.04,我有安装程序tensorflow,现在我正在尝试安装对象检测API。 我从git克隆了API,所以它给了我一个包含以下树的存储库:models / research / 从研究报告中,我已经完成了官方git的所有步骤,我可以运行测试。然后我做了:

`sudo python setup.py install`

我还从源代码编译了protoc编译器以获得最新版本:3.5.1

我收集了我的数据并创建了tf记录并将它们放在数据存储库中。 我将配置文件放在培训库中。 我将数据,培训和模型文件存储库复制到    models/researches/object-detection/

然后我尝试运行train.py脚本以便使用我自己的数据进行训练,但是我得到了以下错误,我真的迷路了,也许我做错了什么。有人有任何想法吗?

`python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config 
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Traceback (most recent call last):
  File "train.py", line 167, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "train.py", line 92, in main
    FLAGS.pipeline_config_path)
  File "/home/jimmy/Desktop/ObjectDetecAPI/models/research/object_detection/utils/config_util.py", line 92, in get_configs_from_pipeline_file
    proto_str = f.read()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 120, in read
    self._preread_check()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 80, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: training/ssd_mobilenet_v1_coco.config; No such file or directory
'
   `/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type.
  from ._conv import register_converters as _register_converters
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Traceback (most recent call last):
  File "train.py", line 167, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "train.py", line 92, in main
    FLAGS.pipeline_config_path)
  File "/home/jimmy/Desktop/ObjectDetecAPI/models/research/object_detection/utils/config_util.py", line 92, in get_configs_from_pipeline_file
    proto_str = f.read()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 120, in read
    self._preread_check()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 80, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: training/ssd_mobilenet_v1_coco.config; No such file or directory`

但我很确定我的训练存储库里面有配置文件。

1 个答案:

答案 0 :(得分:0)

基于以下追溯:

tensorflow.python.framework.errors_impl.NotFoundError: training/ssd_mobilenet_v1_coco.config; No such file or directory`

您的配置文件的以下路径似乎未正确定义。

--pipeline_config_path=training/ssd_mobilenet_v1_coco.config

我建议你在尝试训练模型之前使用绝对文件路径和/或双重检查你有正确的PYTHONPATH变量设置。它可能就像你的道路或你的PYTHONPATH中的拼写错误一样简单。

Ubuntu:在使用TensorFlow Object Detection API之前,请参阅以下有关设置PYTHONPATH变量的说明: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md#add-libraries-to-pythonpath