1
import tensorflow as tf


imagePath = '/home/sk/test_set'


image_list = tf.gfile.ListDirectory(imagePath)
for i in image_list:
   image_data = tf.gfile.FastGFile(i, 'rb').read()

when excute this code error occured

Traceback (most recent call last):
  File "/home/sk/tensorflow-classify/photos/as.py", line 18, in <module>
    image_data = tf.gfile.FastGFile(i, 'rb').read()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 115, in read
    self._preread_check()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 75, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: 11.jpg

i think tf.gfile.FastGFile(i, 'rb').read() this is not properly working. it works when file name is 1.jpg, but changing file name following error occurs

how can i fix this problem

1 Answer 1

1

It looks like the path imagePath = '/home/sk/test_set' is not correct or the method accepts relatives routes.

Check the example here There are a FLAGS variable where defines all the routes, follow the leed based on your file structure, and where do you have the proyect

Sign up to request clarification or add additional context in comments.

1 Comment

FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string('image_path', "test_set", """ test_set""") i tried it but same error occurs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.