title: Number of classes, 4, does not match size of target_names, 6. Try specifying the labels parameter
body: <p>I am facing some issue when I try to make confusion matrix of my CNN model.When I run the code , it returns some error like :</p>
  
  <pre><code>print(classification_report(np.argmax(y_test,axis=1), y_pred,target_names=target_names))
  
  Traceback (most recent call last):
  
    File "&lt;ipython-input-102-82d46efe536a&gt;", line 1, in &lt;module&gt;
      print(classification_report(np.argmax(y_test,axis=1), y_pred,target_names=target_names))
  
    File "G:\anaconda_installation_file\lib\site-packages\sklearn\metrics\classification.py", line 1543, in classification_report
      "parameter".format(len(labels), len(target_names))
  
  ValueError: Number of classes, 4, does not match size of target_names, 6. Try specifying the labels parameter
  </code></pre>
  
  <p>Already I have searched about to solve this problem but still don't get the perfect solution.
  I am totally new in this field, can anyone help me out?
  Thanks.</p>
  
  <pre><code>from sklearn.metrics import classification_report,confusion_matrix
  import itertools
  
  Y_pred = model.predict(X_test)
  print(Y_pred)
  y_pred = np.argmax(Y_pred, axis=1)
  print(y_pred)
  
  target_names = ['class 0(cardboard)', 'class 1(glass)', 'class 2(metal)','class 3(paper)', 'class 4(plastic)','class 5(trash)']
  
  print(classification_report(np.argmax(y_test,axis=1), y_pred,target_names=target_names))
  </code></pre>