Tensorflow 跳过队列未关闭时取消的出列尝试
我有如下训练的阅读数据Tensorflow 跳过队列未关闭时取消的出列尝试,tensorflow,Tensorflow,我有如下训练的阅读数据 def read_data(batch_size, input_shape, file_src): reader = tf.TextLineReader() _, value = reader.read(file_src) filename, label, box1, box2, box3, box4, box5, box6, box7, box8 = tf.decode_csv(value, [[''], [''], [''],[''],[''],[''],
def read_data(batch_size, input_shape, file_src):
reader = tf.TextLineReader()
_, value = reader.read(file_src)
filename, label, box1, box2, box3, box4, box5, box6, box7, box8 = tf.decode_csv(value, [[''], [''], [''],[''],[''],[''],[''],[''],[''],['']], ' ')
boxes = tf.transpose(tf.stack([tf.strings.to_number(box1,tf.dtypes.float32),tf.strings.to_number(box2,tf.dtypes.float32),tf.strings.to_number(box3,tf.dtypes.float32),tf.strings.to_number(box4,tf.dtypes.float32),tf.strings.to_number(box5,tf.dtypes.float32),tf.strings.to_number(box6,tf.dtypes.float32),tf.strings.to_number(box7,tf.dtypes.float32),tf.strings.to_number(box8,tf.dtypes.float32)]))
image_file = tf.read_file(filename)
height, width, channels_num = input_shape
rgb_image = tf.image.decode_jpeg(image_file, channels=channels_num)
rgb_image_float = tf.image.convert_image_dtype(rgb_image, tf.float32)
resized_images = tf.image.resize_images(rgb_image_float, [height, width])
resized_images.set_shape(input_shape)
min_after_dequeue = 30000
capacity = min_after_dequeue + 3 * batch_size
image_batch, label_batch, boxes_batch = tf.train.shuffle_batch([resized_images, label, boxes], batch_size=batch_size, capacity=capacity,
min_after_dequeue=min_after_dequeue)
return image_batch, label_batch, boxes_batch
当我在sess中运行时,我有这样的错误
coordinator = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=session, coord=coordinator)
for i in range(config.train.steps):
curr_step, curr_learning_rate, curr_loss, curr_opt_loss = session.run([global_step_rec, learning_rate, loss, opt_loss])
确切的错误是
2019-11-13 10:54:40.738358: W tensorflow/core/kernels/queue_base.cc:285] _1_shuffle_batch/random_shuffle_queue: Skipping cancelled dequeue attempt with queue not closed
FailedPreconditionError: FailedPr...onError()
可能有什么问题?需要根据自己的数据调整排队后的
分钟数和容量。比如说,我有1000个数据集,那么minu\u-after\u-dequeue
不需要高,需要设置为低于1000。它是队列中剩余的数据量,以便从缓冲区检索下一批数据。如果队列中有足够的数据,就可以了。容量是队列中的最大数据数