title: Keras: ValueError: No data provided for "input_1". Need data for each key
body: <p>I am using the keras functional API with input images of dimension (224, 224, 3). I have the following model using the functional API, although a similar problem seems to arise with sequential models:</p>
  
  <pre><code>input = Input(shape=(224, 224, 3,))
  shared_layers = Dense(16)(input)
  model = KerasModel(input=input, output=shared_layers)
  model.compile(loss='binary_crossentropy', optimizer='sgd', metrics='accuracy'])
  </code></pre>
  
  <p>I am calling <code>model.fit_generator</code> where my generator has </p>
  
  <pre><code>yield ({'input_1': image}, {'output': classification}) 
  </code></pre>
  
  <p><code>image</code> is the input (224, 224, 3) image and <code>classification</code> is in {-1,1}.</p>
  
  <p>On fitting the model, I get an error </p>
  
  <pre><code>ValueError: No data provided for "dense_1". Need data for each key in: ['dense_1']
  </code></pre>
  
  <p>One strange thing is that if I switch the <code>input_1</code> target of the dict to <code>dense_1</code>, the error switches to missing an input for <code>input_1</code>, but goes back to missing <code>dense_1</code> if both keys are in the data generator.</p>
  
  <p>This happens whether I call <code>fit_generator</code> or get batches from the generator and call <code>train_on_batch</code>.</p>
  
  <p>Does anyone know what's going on? From what I can tell, this should be the same as given in <a href="https://keras.io/models/model/" rel="noreferrer">the documentation</a> although with a different input size.</p>
  
  <pre><code>Full traceback:
  Traceback (most recent call last):
    File "pymask.py", line 303, in &lt;module&gt;
      main(sys.argv)
    File "pymask.py", line 285, in main
      keras.callbacks.ProgbarLogger()
    File "/home/danielunderwood/virtualenvs/keras/lib/python3.6/site-packages/keras/engine/training.py", line 1557, in fit_generator
      class_weight=class_weight)
    File "/home/danielunderwood/virtualenvs/keras/lib/python3.6/site-packages/keras/engine/training.py", line 1314, in train_on_batch
      check_batch_axis=True)
    File "/home/danielunderwood/virtualenvs/keras/lib/python3.6/site-packages/keras/engine/training.py", line 1029, in _standardize_user_data
      exception_prefix='model input')
    File "/home/danielunderwood/virtualenvs/keras/lib/python3.6/site-packages/keras/engine/training.py", line 52, in standardize_input_data
      str(names))
  ValueError: No data provided for "input_1". Need data for each key in: ['input_1']
  </code></pre>