Docker Community Forums

Share and learn in the Docker community.

Problem running label_image.py

docker

(Zehandai2018) #1

I’m a new to docker and I’m trying to use the Docker Tensorflow to make an image classifier.

I tried to run this py script but error occurred.

root@4a44e2a12d7d:/tensorflow# python ./tf_files/label_image.py ./tf_files/flower_photos/dandelion/6900157914_c3387c11d8.jpg
Traceback (most recent call last):
File “./tf_files/label_image.py”, line 14, in
in tf.gfile.GFile("/tf_files/retrained_labels.txt")]
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py”, line 208, in next
retval = self.readline()
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py”, line 177, in readline
self._preread_check()
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py”, line 79, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py”, line 473, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /tf_files/retrained_labels.txt; No such file or directory
root@4a44e2a12d7d:/tensorflow#

I’m sure the files are in the path:
root@4a44e2a12d7d:/tensorflow/tf_files# ls
bottlenecks flower_photos flower_photos.tgz inception label_image.py retrained_graph.pb retrained_labels.txt

And the path in the .py file should be right


the original script in Github is here:

I also tried ‘chmod 777 -R /tf_files/’, as some ones in google said and it does not work.

Have any encountered similar problem before?


(Sam) #2

the message says

/tf_files/retrained_labels.txt; No such file or directory

NOT

/tensorflow/tf_files/retrained_labels.txt; No such file or directory

the app is expecting /tf_files to be in the ROOT of the volume

you have it in a subfolder called tensorflow


(Zehandai2018) #3

Yes! Finally I made it run! Thank you !!