def get_batch(image, label, image_W, image_H, batch_size, capacity):
image = tf.cast(image, tf.string)
label = tf.cast(label, tf.int32)
#生成列队
input_queue = tf.train.slice_input_producer([image, label])
label = input_queue[1]
image_contents = tf.read_file(input_queue[0])
image = tf.image.decode_jpeg(image_contents, channels=3)
image = tf.image.resize_image_with_crop_or_pad(image, image_W, image_H)
a = tf.reduce_mean(image)
image = tf.subtract(image,a)
image_batch, label_batch = tf.train.batch([image, label],
batch_size= batch_size,
num_threads= 16,
capacity = capacity)
label_batch = tf.reshape(label_batch, [batch_size])
image_batch = tf.cast(image_batch, tf.float3
tensorflow batch函数实现
最新推荐文章于 2021-10-17 10:34:00 发布