title: How to get confusion matrix when using model.fit_generator
body: <p>I am using model.fit_generator to train and get results for my binary (two class) model because I am giving input images directly from my folder. How to get confusion matrix in this case (TP, TN, FP, FN) as well because generally I use <code>confusion_matrix</code> command of <code>sklearn.metrics</code> to get it, which requires <code>predicted</code>, and <code>actual</code> labels. But here I don't have both. May be I can calculate predicted labels from <code>predict=model.predict_generator(validation_generator)</code> command. But I don't know how my model is taking input labels from my images. General structure of my input folder is:</p>
  
  <pre><code>train/
   class1/
       img1.jpg
       img2.jpg
       ........
   class2/
       IMG1.jpg
       IMG2.jpg
  test/
   class1/
       img1.jpg
       img2.jpg
       ........
   class2/
       IMG1.jpg
       IMG2.jpg
       ........
  </code></pre>
  
  <p>and some blocks of my code is:</p>
  
  <pre><code>train_generator = train_datagen.flow_from_directory('train',  
          target_size=(50, 50),  batch_size=batch_size,
          class_mode='binary',color_mode='grayscale')  
  
  
  validation_generator = test_datagen.flow_from_directory('test',
          target_size=(50, 50),batch_size=batch_size,
          class_mode='binary',color_mode='grayscale')
  
  model.fit_generator(
          train_generator,steps_per_epoch=250 ,epochs=40,
          validation_data=validation_generator,
          validation_steps=21 )
  </code></pre>
  
  <p>So the above code automatically takes two class inputs, but I don't know for which it consider class 0 and for which class 1.</p>