Tensorflow Windows Accessing Folders Denied: "NewRandomAccessFile failed to create / open: access denied. I / O error"

I recently installed Tensorflow for Windows. I am trying to create a basic tutorial in which I need to access a folder containing subfolders of images.

I cannot access the images folder because "access is denied." This happens both at the Anaconda 4.2 prompt and in Pycharm and using the main Python 3.5 distribution.

I granted administrator rights to everyone, and I reinstalled all the software today, so it has been updated to the latest versions.

Any thoughts or help would be greatly appreciated!

# change this as you see fit
image_path = 'C:/moles'

# Read in the image_data
image_data = tf.gfile.FastGFile(image_path, 'rb').read()

# Loads label file, strips off carriage return
label_lines = [line.rstrip() for line
               in tf.gfile.GFile("/tf_files/retrained_labels.txt")]

# Unpersists graph from file
with tf.gfile.FastGFile("/tf_files/retrained_graph.pb", 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    _ = tf.import_graph_def(graph_def, name='')

with tf.Session() as sess:
    # Feed the image_data as input to the graph and get first prediction
    softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')

    predictions = sess.run(softmax_tensor, \
                           {'DecodeJpeg/contents:0': image_data})

    # Sort to show labels of first prediction in order of confidence
    top_k = predictions[0].argsort()[-len(predictions[0]):][::-1]

    for node_id in top_k:
        human_string = label_lines[node_id]
        score = predictions[0][node_id]
        print('%s (score = %.5f)' % (human_string, score))

"C: \ Program Files \ Anaconda3 \ python.exe" C: /Users/Ryan/Desktop/tfupdate/tf.py Traceback (last last call):

"C:/Users/Ryan/Desktop/tfupdate/tf.py", 7,   image_data = tf.gfile.FastGFile(image_path, 'rb'). read()

"C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", 106, read   self._preread_check()

"C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", 73, _preread_check   compat.as_bytes (self.__ name), 1024 * 512, )

"C:\Program Files\Anaconda3\lib\contextlib.py", 66,    (self.gen)

"C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", 469, raise_exception_on_not_ok_status   pywrap_tensorflow.TF_GetCode ())

tensorflow.python.framework.errors_impl.UnknownError: NewRandomAccessFile /: C:/moles: . ; /

1

+4
1

/tf_files/retrained_labels.txt retrained_labels.txt /tf_files/retrained_graph.pb

+2

Source: https://habr.com/ru/post/1663592/


All Articles