def readFromFile(self, filename_list, batch_size, img_shape, num_threads=4, min_after_dequeue=10000):
filename_queue = tf.train.string_input_producer(filename_list, shuffle=False)
reader = tf.WholeFileReader()
_, serialized_example = reader.read(filename_queue)
image = tf.image.decode_jpeg(serialized_example, channels=3)
image.set_shape(img_shape)
images = tf.train.shuffle_batch(
[image], batch_size=batch_size, num_threads=num_threads,
capacity=min_after_dequeue + (num_threads + 1) * batch_size,
min_after_dequeue=min_after_dequeue,
)
return images
评论列表
文章目录