尝试训练模型时的Tensorflow错误

时间:2018-08-14 10:49:14

标签: python tensorflow

运行python train.py --logtostderr --train_dir = training / --pipeline_config_path = training / faster_rcnn_inception_v2_pets.config

时出错
    \trainer.py:260: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "F:\Software\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "train.py", line 180, in main
    graph_hook_fn=graph_rewriter_fn)
  File "D:\Studies\Python Scripts\Test\trainer.py", line 274, in train
    train_config.prefetch_queue_capacity, data_augmentation_options)
  File "D:\Studies\Python Scripts\Test\trainer.py", line 59, in create_input_queue
    tensor_dict = create_tensor_dict_fn()
  File "train.py", line 120, in get_next
    return dataset_util.make_initializable_iterator(

以下内容:https://github.com/satendrapandeymp/object_detection 我已经成功地使用网络摄像头实现了对象检测api测试,但是现在在训练模型上,这些错误不断出现

但是,来自Python本机cmd运行的另一个错误。

 python train.py --logtostderr --train_dir = training / --pipeline_config_path = training / faster_rcnn_inception_v2_pets.config
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "train.py", line 93, in main
    FLAGS.pipeline_config_path)
  File "C:\tensorflow1\models\research\object_detection\utils\config_util.py", line 93, in get_configs_from_pipeline_file
    proto_str = f.read()
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
    self._preread_check()
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 85, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.UnknownError: NewRandomAccessFile failed to Create/Open: = : Access is denied.
; Input/output error

Conda环境运行

python train.py --logtostderr --train_dir = training / --pipeline_config_path = training / faster_rcnn_inception_v2_pets.config
F:\Software\Anaconda3\lib\site-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
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "F:\Software\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "train.py", line 93, in main
    FLAGS.pipeline_config_path)
  File "C:\tensorflow1\models\research\object_detection\utils\config_util.py", line 93, in get_configs_from_pipeline_file
    proto_str = f.read()
  File "F:\Software\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
    self._preread_check()
  File "F:\Software\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 85, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "F:\Software\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.UnknownError: NewRandomAccessFile failed to Create/Open: = : Access is denied.
; Input/output error

1 个答案:

答案 0 :(得分:0)

不看代码很难说,但是文件FLAGS.pipeline_config_path似乎有问题,Windows无法找到该文件,或者没有读取该文件的权限。 / p>

也许是因为当您设置training / faster_rcnn_inception_v2_pets.config之类的参数值时,您在"/"之前和之后使用空格。

似乎这是Tensorflow的Github中已报告的问题,也许您可​​以找到解决方案in this link