Closed jjcao closed 6 years ago
I wrote a simple test.py to read './SegmentationClassAug/2007_000033.png'. It works. Why tf.read_file failed when it is called by evaluate.py?
import tensorflow as tf import numpy as np
def main(): sess = tf.InteractiveSession() pngFILE = './SegmentationClassAug/2007_000033.png' label_contents = tf.read_file(pngFILE) label = tf.image.decode_png(label_contents, channels=1) sess.close()
if name == 'main': main()
The "\n" is different in windows and linux. Just try your code in Linux
Not sure about this one, as this img_contents = tf.read_file(input_queue[0])
and this ./SegmentationClassAug/2007_000033.png
confuses me: input_queue[0] should point to the JPG file. Something is wrong when reading in your files.
First, make sure that the lists are processed correctly: for example, print the outputs of this function for debugging: https://github.com/DrSleep/tensorflow-deeplab-resnet/blob/master/deeplab_resnet/image_reader.py#L91
I can perform inference over my own images via python inference.py ./test.jpg ./pretrained/deeplab_resnet.ckpt
But when I evaluate the pre-trained model: python evaluate.py --data-dir . --data-list ./dataset/val.txt --restore-from pretrained/deeplab_resnet.ckpt
I met the error:
Restored model parameters from pretrained/deeplab_resnet.ckpt 2017-08-06 20:55:44.006616: W tensorflow/core/framework/op_kernel.cc:1158] Not found: ./SegmentationClassAug/2007000033.png Traceback (most recent call last): File "evaluate.py", line 128, in
main()
File "evaluate.py", line 120, in main
preds, = sess.run([pred, update_op])
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 789, in run
run_metadata_ptr)
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1152, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: ./SegmentationClassAug/2007_000033.png
[[Node: create_inputs/ReadFile_1 = ReadFile_device="/job:localhost/replica:0/task:0/cpu:0"]]
Caused by op u'create_inputs/ReadFile_1', defined at: File "evaluate.py", line 128, in
main()
File "evaluate.py", line 79, in main
coord)
File "/Users/jjcao/Downloads/deeplabV2/deeplab_resnet/image_reader.py", line 168, in init
self.image, self.label = read_images_from_disk(self.queue, self.input_size, random_scale, random_mirror, ignore_label, img_mean)
File "/Users/jjcao/Downloads/deeplabV2/deeplab_resnet/image_reader.py", line 112, in read_images_from_disk
img_contents = tf.read_file(input_queue[0])
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 200, in read_file
result = _op_def_lib.apply_op("ReadFile", filename=filename, name=name)
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/Users/jjcao/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1269, in init
self._traceback = _extract_stack()
NotFoundError (see above for traceback): ./SegmentationClassAug/2007_000033.png [[Node: create_inputs/ReadFile_1 = ReadFile_device="/job:localhost/replica:0/task:0/cpu:0"]]
======================= But ./SegmentationClassAug/2007_000033.png is there. Why image_reader.py fails to read it?
Thank you.