Reputation: 53
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
Upvotes: 1
Views: 131
Reputation: 16214
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
Upvotes: 1