我在用tensorflow训练一个模型时遇到了问题。我正在运行Windows 10。当我运行命令时:
python ./object_detection/model_main.py --pipeline_config_path=C:/Tensorflow/object-detection/ssd_mobilenet_v1_coco_2018_01_28 --model_dir=C:/Tensorflow/object-detection/output-model --num_train_steps=50000 --sample_1_of_n_eval_examples=1 --alsologtostderr从C:/Tensorflow/models/research开始培训过程,我从config_util.py脚本中得到了第95行(proto_str = f.read())中的一个错误。下面可以看到我的整个控制台输出:
Traceback (most recent call last):
File "./object_detection/model_main.py", line 109, in <module>
tf.app.run()
File "C:\Users\lucci\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "./object_detection/model_main.py", line 71, in main
FLAGS.sample_1_of_n_eval_on_train_examples))
File "C:\Tensorflow\models\research\object_detection\model_lib.py", line 536, in create_estimator_and_inputs
config_override=config_override)
File "C:\Tensorflow\models\research\object_detection\utils\config_util.py", line 95, in get_configs_from_pipeline_file
proto_str = f.read()
File "C:\Users\lucci\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
self._preread_check()
File "C:\Users\lucci\AppData\Local\Programs\Python\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:\Users\lucci\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 528, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.UnknownError: NewRandomAccessFile failed to Create/Open: C:/Tensorflow/object-detection/ssd_mobilenet_v1_coco_2018_01_28 : Zugriff verweigert
; Input/output error错误出现在最后两行:Zugriff verweigert是德语,意思是access denied。
我是管理员在这台pc (这是我自己的pc),我有FullControl到文件夹(我反复检查它与PowerShell)。当我试图将文件夹移动到另一个地方时,例如C:\Users\lucci\Documents\,我会得到相同的错误。当我以管理员身份运行控制台、尝试命令runas /user:lucci ...等时,问题仍然存在。
有人能帮我吗?我正在使用Python3.6。
发布于 2018-11-18 20:57:01
我终于自己找到了解决办法。您是在Linux还是Windows上操作并不重要。运行该命令时,始终必须指定指向文件的完整路径。因此,当您的管道. location文件位于C:/ObjectDetection/Model/pipeline.config中时,仅指定像C:/ObjectDetection/这样的位置是不够的。您必须将位置指定为C:/ObjectDetection/pipeline.config。
再次运行命令与全路径的参数--pipeline_config_file工作伟大!
https://stackoverflow.com/questions/53327026
复制相似问题