Python tensorflow检查图像在读卡器中

Python tensorflow检查图像在读卡器中,python,image,tensorflow,Python,Image,Tensorflow,我不确定TensorFlow是否真的解码了一幅图像,但输出仅为:Tensor(“DecodeJpeg:0”,shape=TensorShape([Dimension(None),Dimension(None),Dimension(None),Dimension(None)],dtype=uint8) 如何显示张量对象的图像和标签? (部分代码来自:) 如何在图像中显示实际图像,并同时显示标签?因为图像是否确实在同一文件夹中并不改变image和label的输出 编辑 下面的代码(部分来自:)在我的

我不确定TensorFlow是否真的解码了一幅图像,但输出仅为:
Tensor(“DecodeJpeg:0”,shape=TensorShape([Dimension(None),Dimension(None),Dimension(None),Dimension(None)],dtype=uint8)

如何显示张量对象的图像和标签?

(部分代码来自:)

如何在
图像
中显示实际图像,并同时显示
标签
?因为图像是否确实在同一文件夹中并不改变
image
label
的输出

编辑 下面的代码(部分来自:)在我的朋友Mac上显示了一个图像,但在我的Ubuntu 14.04上没有:

# Test show image
images = []
with tf.Session() as sess:

    # Start populating the filename queue.
    coord = tf.train.Coordinator()
    threads = tf.train.start_queue_runners(sess=sess, coord=coord)

    if len(string) > 0:
      for i in range(len(string)):
        plaatje = result.image.eval()
        images.append(plaatje)

    Image._showxv(Image.fromarray(np.asarray(plaatje)))

    coord.request_stop()
    coord.join(threads)
    print("tf.session success")
这将导致以下错误

W tensorflow/core/common_runtime/executor.cc:1076] 0x7fa3940cb950 Compute status: Cancelled: Enqueue operation was cancelled
 [[Node: input_producer/input_producer_EnqueueMany = QueueEnqueueMany[Tcomponents=[DT_STRING], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](input_producer, input_producer/RandomShuffle)]]
I tensorflow/core/kernels/queue_base.cc:278] Skipping cancelled enqueue attempt

在你的第二段代码中似乎遗漏了代码,不是吗

尝试建议的解决方案。在启动队列运行程序之前,必须初始化占位符。这为我解决了一个类似的问题


我猜你们已经明白了,为了得到张量的实际值,你们必须在张量上调用
.eval()
。查看此

是否可以使用包含“计算状态:…”的任何其他日志更新您的问题?“取消”错误通常是运行线程的队列中早期错误的症状。(例如,如果找不到该文件,您将看到此错误。)
W tensorflow/core/common_runtime/executor.cc:1076] 0x7fa3940cb950 Compute status: Cancelled: Enqueue operation was cancelled
 [[Node: input_producer/input_producer_EnqueueMany = QueueEnqueueMany[Tcomponents=[DT_STRING], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](input_producer, input_producer/RandomShuffle)]]
I tensorflow/core/kernels/queue_base.cc:278] Skipping cancelled enqueue attempt