Search code examples
pythontensorflowaccess-denied

Tensorflow access denied in config_util.py while training


I have a problem with training a model in tensorflow. I am working on Windows 10. When I run the command:

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

from C:/Tensorflow/models/research to start the training process I get an error in line 95 (proto_str = f.read()) from the config_util.py script. Below you can see my whole console output:

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

The error is in the last two lines: Zugriff verweigert is german and means access denied.
I am admin on this pc (it's my own pc) and i have FullControl to the folders (I double-checked it with PowerShell). When I try to move the folder to another place, e.g. C:\Users\lucci\Documents\ I get the same error. The problem still remains when I run the console as admin, when I try the command runas /user:lucci ... and so on.

Can anyone help me with this? I am using Python3.6.

EDIT: This also not helps: Tensorflow Windows Accessing Folders Denied:"NewRandomAccessFile failed to Create/Open: Access is denied. ; Input/output error"


Solution

  • I finally found the solution on my own. It does not matter if you are operating on Linux or Windows. When you run the command you always have to specify the full path to the pipeline.config file. So, when your pipeline.config-file is located in C:/ObjectDetection/Model/pipeline.config it is not sufficient to specify the location like C:/ObjectDetection/. You have to specify the location as C:/ObjectDetection/pipeline.config.

    Running the command again with the full path for the Parameter --pipeline_config_file works great!!!