title: How to load image data for regression with keras?
body: <p>I already have read now several tutorials that are giving instructions of how to import images for classification with Keras. As far as I see, all tutorials are just describing a multi-class scenario (e.g. cat/dog class.). These approaches don`t apply to my problem.</p>
  <p>I want to do a regression that takes the images as input and returns images as output.
  My question: <strong>How would I easily pass the image data to Keras, if there is no classification but regression?</strong></p>
  <p>With each pair of given input and output training data, I can't find an easy import from:</p>
  <pre><code>├── input_data
  │   ├── input0.png
  |   ├── input1.png
  |   └── ...
  └── output_data
      ├── output0.png
      ├── output1.png
      └── ...
  </code></pre>
  <p>to this point:</p>
  <pre><code>x_train, x_valid, y_train, y_valid = train_test_split(inputs, outputs, test_size=0.2, shuffle= True)
  </code></pre>
  <p><em>What I have already tried:</em></p>
  <ol>
  <li><p>The Keras <a href="https://keras.io/api/preprocessing/image/#flowfromdirectory-method" rel="nofollow noreferrer">flow_from_directory</a> method seems almost perfect and offers nice functionalities, but it only applies for classification data that is sorted in subdirectories.</p>
  </li>
  <li><p>Secondly, there is this <a href="https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/load_img" rel="nofollow noreferrer">image import function,</a> given by Tensorflow.</p>
  <pre><code>from keras.preprocessing.image import img_to_array, load_img
  img = load_img('img.png') 
  x = img_to_array(img)
  </code></pre>
  </li>
  </ol>
  <p>It is also straight forward as far as I know, there is only the possibility to open single images and not whole directories. This might be helpful if iterating over the whole directory, but since Keras has those nice <strong>preprocessing features</strong>, I am curious to know if there is a keras-like way. So my question:</p>
  <p><strong>Is there any comortable way to import large image datasets for regression?</strong></p>