title: multiple image input training using dataset object
body: <p>How to use a dataset object as input in the <code>model.fit()</code> training loop, for a model with multiple inputs?
  Trying to pass the dataset itself gives me the following error:</p>
  <pre><code>Failed to find data adapter that can handle input: (&lt;class 'list'&gt; containing values of types {&quot;&lt;class 'tensorflow.python.data.ops.dataset_ops.MapDataset'&gt;&quot;}), &lt;class 'NoneType'&gt;
  </code></pre>
  <p>My case here:</p>
  <p>I have a multiple input model built with keras
  The inputs are named <code>'First'</code>, <code>'Second'</code> and <code>'Third'</code></p>
  <p>I have an image dataset in keras-style:</p>
  <pre><code>main_directory/
  ...class_a/
  ......a_image_1.jpg
  ......a_image_2.jpg
  ...class_b/
  ......b_image_1.jpg
  ......b_image_2.jpg
  </code></pre>
  <p>I create the dataset object using <code>tf.keras.utils.image_dataset_from_directory</code>:</p>
  <pre><code>train_dataset = image_dataset_from_directory(train_dir,
                                               shuffle=False,
                                               label_mode='categorical',
                                               batch_size=hyperparameters[&quot;BATCH_SIZE&quot;],
                                               image_size=IMG_SIZE)
  </code></pre>
  <p>Now, each image is divided in 3 parts, each part serving as input to each of the inputs of the model. I take care of that using some map functions. This is not relevant tot he problem and I will not include it. I cannot use the cropping layers included in TF because of unrelated reasons.</p>
  <p>I then try to start the training loop:</p>
  <pre><code> history = model.fit([train_dataset1, 
                        train_dataset2, 
                        train_dataset3,
                        ],
                        epochs=epochs, 
                        callbacks=callbacks,
                        validation_data=validation_dataset
                        validation_steps=steps
                        )
  </code></pre>
  <p>And here is where I get the error.
  I have tried some other approaches, like using a dict instead of a list.
  The problem seems to be that when training a model with multiple inputs, the fit() loop expects data to come as a list for x-values and a list for y-values, but I haven't been able to split the dataset object into the required formats</p>
  <p>I have read many topics on this, but all use datasets that are created using the <code>tf.data.Dataset.from_tensor_slices()</code> method, which is not applicable in my case</p>
  <p>Additionally, there is no indication of how the validation dataset has to be structured (at least according to the <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model#fit" rel="nofollow noreferrer">model.fit() documentation</a>)</p>
  <p>I have found some guidance saying that the validation dataset must have the same number of input/outputs as the training datasets (makes sense), but again, no indication on how to build or feed the validation dataset for a multiple input model</p>