title: How to fix "DataLossError : Unable to open table file .\checkpoints: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied"?
body: <p>I have trained a model (Here's <a href="https://github.com/GeorgeSeif/Semantic-Segmentation-Suite" rel="nofollow noreferrer">a link</a>!) I successfully trained the model by:</p>
  
  <pre><code>python train.py --model DeepLabV3_plus
  </code></pre>
  
  <p>and when I wanted to run test.py I got the error mentioned in the title. The checkpoints folder includes all the necessary weights for testing and I tried to assign the checkpoint to the model with:</p>
  
  <pre><code>python test.py --model DeepLabV3_plus --checkpoint_path checkpoints
  </code></pre>
  
  <p>but failed running it. Could you please help me to run the test.py? </p>
  
  <p>P.S: I eventually need to predict the model on a new dataset, any help for that part is also appreciated.</p>
  
  <p>I have read <a href="https://github.com/davidsandberg/facenet/issues/251" rel="nofollow noreferrer">https://github.com/davidsandberg/facenet/issues/251</a> and <a href="https://github.com/balancap/SSD-Tensorflow/issues/150" rel="nofollow noreferrer">https://github.com/balancap/SSD-Tensorflow/issues/150</a> but they couldn't help me.</p>
  
  <pre class="lang-none prettyprint-override"><code>Loading model checkpoint weights ...
  2019-09-08 20:05:13.667832: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open .\checkpoints: Unknown: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied.
  ; Input/output error
  2019-09-08 20:05:13.873491: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open .\checkpoints: Unknown: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied.
  ; Input/output error
  2019-09-08 20:05:13.878487: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at save_restore_tensor.cc:175 : Data loss: Unable to open table file .\checkpoints: Unknown: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied.
  ; Input/output error
  Traceback (most recent call last):
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1334, in _do_call
      return fn(*args)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1319, in _run_fn
      options, feed_dict, fetch_list, target_list, run_metadata)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1407, in _call_tf_sessionrun
      run_metadata)
  tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file .\checkpoints: Unknown: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied.
  ; Input/output error
           [[{{node save_1/RestoreV2}} = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_1/Const_0_0, save_1/RestoreV2/tensor_names, save_1/RestoreV2/shape_and_slices)]]
           [[{{node save_1/RestoreV2/_307}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_312_save_1/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "test.py", line 43, in &lt;module&gt;
      saver.restore(sess, args.checkpoint_path)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 1546, in restore
      {self.saver_def.filename_tensor_name: save_path})
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 929, in run
      run_metadata_ptr)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1152, in _run
      feed_dict_tensor, options, run_metadata)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1328, in _do_run
      run_metadata)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1348, in _do_call
      raise type(e)(node_def, op, message)
  tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file .\checkpoints: Unknown: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied.
  ; Input/output error
           [[node save_1/RestoreV2 (defined at test.py:42)  = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_1/Const_0_0, save_1/RestoreV2/tensor_names, save_1/RestoreV2/shape_and_slices)]]
           [[{{node save_1/RestoreV2/_307}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_312_save_1/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
  
  Caused by op 'save_1/RestoreV2', defined at:
    File "test.py", line 42, in &lt;module&gt;
      saver=tf.train.Saver(max_to_keep=1000)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 1102, in __init__
      self.build()
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 1114, in build
      self._build(self._filename, build_save=True, build_restore=True)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 1151, in _build
      build_save=build_save, build_restore=build_restore)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 795, in _build_internal
      restore_sequentially, reshape)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 406, in _AddRestoreOps
      restore_sequentially)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\training\saver.py", line 862, in bulk_restore
      return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 1466, in restore_v2
      shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
      op_def=op_def)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
      return func(*args, **kwargs)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 3274, in create_op
      op_def=op_def)
    File "C:\Users\xxxxx\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 1770, in __init__
      self._traceback = tf_stack.extract_stack()
  
  DataLossError (see above for traceback): Unable to open table file .\checkpoints: Unknown: NewRandomAccessFile failed to Create/Open: .\checkpoints : Access is denied.
  ; Input/output error
           [[node save_1/RestoreV2 (defined at test.py:42)  = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_1/Const_0_0, save_1/RestoreV2/tensor_names, save_1/RestoreV2/shape_and_slices)]]
           [[{{node save_1/RestoreV2/_307}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_312_save_1/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
  </code></pre>