【问题标题】:Input several images in tensorflow session.run()在 tensorflow session.run() 中输入多张图片
【发布时间】:2019-10-18 23:07:38
【问题描述】:

我有一个代码使用 tensorflow 通过 GPU 分析一些图像,我使用 tf.session 并在模型的 session.run 中引入帧

with tf.Session() as sess:
    res, img = cap.read()
    heatmaps_result, offsets_result, displacement_fwd_result, displacement_bwd_result = sess.run(model_outputs,feed_dict={'image:0': my_batch[0]})

当我在 GPU 上运行它时,它有空闲空间,所以我想介绍几张图片。我已经尝试了Bach several images in tensorflow 中所说的,但我得到了错误:

“名称‘image_tensor:0’指的是一个不存在的Tensor。操作‘image_tensor’在图中不存在。”

我已将 bach 中的图像介绍为:

cnt = 0
my_batch = list()
while (cnt < 5):
    cnt = cnt + 1
    res, img = cap.read()
    if not res:
        break
    my_batch.append(img)

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    是否存在名称为“image:0”的占位符,因为在使用 feed_dict 时您需要提供与输入占位符对应的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-19
      • 2018-05-06
      • 2020-08-13
      • 2016-10-16
      • 1970-01-01
      • 2019-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多