title: Using Keras ImageDataGenerator predictions for indexing raises unhashable type error
body: <p>I have created a classifier for <a href="https://keras.io/preprocessing/image/" rel="nofollow noreferrer"><code>ImageDataGenerator</code></a>, created using <code>flow_from_directory</code> such as:</p>
  
  <pre><code>training_imGenProp = ImageDataGenerator(
      rescale=1. / 255,
      width_shift_range=0.02,
      height_shift_range=0.02,
  )
  
  training_imGen = training_imGenProp.flow_from_directory(
      'Location/to/train/images',
      target_size=(74, 448),
      batch_size=batchSize,
      class_mode='binary',
  )
  </code></pre>
  
  <p>When running it, I get <code>TypeError: unhashable type: 'numpy.ndarray'</code> in the last row of the following code snippet:</p>
  
  <pre><code>predictions = classifier.predict_generator(testing_imGen)
  predictions = (predictions &gt;= 0.5).astype(int)
  label_map = (training_imGen.class_indices)
  inverted_label_map = dict((v, k) for k, v in label_map.items())  #flip k,v
  predictions = [label_map[k] for k in predictions]
  </code></pre>
  
  <p>What might be causing it?</p>
  
  <p>Additionally, how should I proceed to generate a confusion matrix from this classifier results?</p>
  
  <p>This:</p>
  
  <pre><code>tn, fp, fn, tp = confusion_matrix(label_map, predictions).ravel()
  </code></pre>
  
  <p>raises an error <code>ValueError: Found input variables with inconsistent numbers of samples: [2,(663, 1)]</code>.</p>