Tensor.eval()没有输出。只是在IPython笔记本中闪烁的光标

时间:2017-04-08 16:46:21

标签: image-processing machine-learning tensorflow ipython

我正在尝试读取tensorflow中的多个图像,这是我从stackoverflow中获取的代码

sess = tf.InteractiveSession() 
filenames = ['/Users/darshak/TensorFlow/1.jpg', '/Users/darshak/TensorFlow/10.jpg']
filename_queue = tf.train.string_input_producer(filenames)
reader = tf.WholeFileReader()
filename, content = reader.read(filename_queue)
image = tf.image.decode_jpeg(content, channels=3)

现在我跑的时候,

image.eval()

我没有输出。只是一个闪烁的光标。我如何看出是否有问题?

1 个答案:

答案 0 :(得分:0)

You need to start the queue runners. Just add the following after creating the session, and before evaluating image.

coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)

For more, check out Threading and Queues.