【问题标题】:Tensorflow FIFOQueue '_4_batch_join/fifo_queue' is closed and has insufficient elementsTensorflow FIFOQueue '_4_batch_join/fifo_queue' 已关闭且元素不足
【发布时间】:2017-02-22 11:24:28
【问题描述】:

张量流版本:1.0.0

    NUM_THREADS = 4
    BATCH_SIZE = 32
    csv_file_queue = tf.train.string_input_producer(csv_files, shuffle=False)
    jpg_file_queue = tf.train.string_input_producer(jpg_files, shuffle=False)
    data_batch_list = [read_data(csv_file_queue, jpg_file_queue) for _ in range(NUM_THREADS)]
    csv_data_batch, jpg_data_batch = tf.train.batch_join(data_batch_list, batch_size=BATCH_SIZE)

    sess.run(tf.group(tf.global_variables_initializer(), tf.local_variables_initializer()))

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

OutOfRangeError(回溯见上文):FIFOQueue '_4_batch_join/fifo_queue' 已关闭且元素不足(请求 32,当前大小 17)

【问题讨论】:

    标签: tensorflow


    【解决方案1】:

    这可能在准备最后一批时发生。将 allow_smaller_final_batch=True 添加到您的 train.batch_join 调用中: 来自文档:

    如果 allow_smaller_final_batch 为 True,则批值小于 当队列关闭且没有队列时返回 batch_size 足够的元素来填充批次,否则待处理的元素是 丢弃。此外,所有输出张量的静态形状,如访问 通过 get_shape 方法,第一个 Dimension 值为 None, 并且依赖于固定 batch_size 的操作会失败。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多