Tensorflow:tf.train.shuffle_batch上的数据管道错误

时间:2017-03-15 00:12:49

标签: tensorflow shuffle

我正在向tensorflow中实现的CNN实施数据pipline。

我的管道工作完美如下。

reader = tf.WholeFileReader()
key, value = reader.read(image)
png_im = tf.image.decode_png(value, no_channels)
cropped = tf.random_crop(png_im , size)
batch = tf.train.shuffle_batch([cropped ], batch_size=batch_size,             
capacity=capacity, min_after_dequeue=min_after_dequeue)

但是当我想为此添加标签时,如下所示;

reader = tf.WholeFileReader()
key, value = reader.read(image)
png_im = tf.image.decode_png(value, no_channels)

key, value = reader.read(label)
png_lb = tf.image.decode_png(value, no_channels)

(cropped_im, cropped_lb) = tf.random_crop_images_and_labels(png_im, png_lb, size)
imbatch, lbbatch = tf.train.shuffle_batch([cropped_im, cropped_lb], batch_size=batch_size,             
capacity=capacity, min_after_dequeue=min_after_dequeue)

我的代码在tf.train.shuffle_batch;

给出了floowing错误
tensorflow.python.framework.errors.OutOfRangeError: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 20, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_UINT8, DT_UINT8], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]

图像数量不是6400,批量大小是20。

你能帮我解决这个问题吗?

0 个答案:

没有答案