There are a number of image operations in TensorFlow used for distorting input images during training, e.g. tf.image.random_flip_left_right(image, seed=None)
an
TLDR: you can create queue, define reading and processing data for single element of queue and than make batch - all this with TF methods.
I'm not sure how it works but if you use queues and create batches and read images with tensorflow methods you can work with batch as with single image.
I didn't test it on large datasets yet and don't know how good it is (speed, memory consumption and so on). May be for now it's better to create batch by yourself.
I have seen this in cifar10 example. You can see it here https://github.com/tensorflow/tensorflow/tree/r0.10/tensorflow/models/image/cifar10
tf.train.string_input_producer
. https://github.com/tensorflow/tensorflow/blob/r0.10/tensorflow/models/image/cifar10/cifar10_input.py#L222 You can use different type of queue. For example I try to use tf.train.slice_input_producer
for multiple images. You can read about it here Tensorflow read images with labels read_cifar10
. Processing in distorted_inputs
, it is here https://github.com/tensorflow/tensorflow/blob/r0.10/tensorflow/models/image/cifar10/cifar10_input.py#L138tf.train.batch
or tf.train.shuffle_batch
depending on the parameters and return it from inputs()
and distorted_inputs()
functions. images, labels = cifar10.distorted_inputs()
and do following job. It's here https://github.com/tensorflow/tensorflow/blob/r0.10/tensorflow/models/image/cifar10/cifar10_train.py#L66