I'm new to tflearn and I'm trying to train a CNN to solve image in -> image out regression problems, where the input images are either MxN grayscale or MxNx3 RGB.
I have a very large training set that will not fit in memory, so I would like to train "on the fly", pulling images from disk as training is ready to consume them.
The image_preloader seems to make the assumption that we will always be solving problems where X is an input image and y is a set of scalar labels corresponding to X.
What is the best way within the tflearn framework to do something similar for regression problems where both X and y are images? I feel like I have to be missing something obvious, but I've looked through the Data Utils, Data Augmentation, and Data Preprocessing sections and don't see anything.
For the full scope of what I'm trying to do: I have a large set of images on disk. On the fly, I need to be able to load my images, then do some modifications to the image to define the input images X and y. The images on disk need to be augmented to properly define X and y. Given a minibatch X read from disk, I can define X and y a batch at a time.
In pure TensorFlow you could use something like:
Note the
channels=3
indecode_jpeg
will ensure your images are all tensors of[h, w, 3]
, even if they were originally in a different colourspace.At this point you have single image tensors. You can batch them up using background queues like so:
You'll need to start the queue runners too. This (and the magic numbers in the last code snippet) is explained fairly well in the documentation on batching.