Search code examples
image-processingdeep-learningartificial-intelligenceconfusion-matrixmulticlass-classification

Training and testing accuracy avoided overfitting and have 98% validation accuracy but classification report is always 0.01%?


I have done fruit detection image classification problem using CNN i have done all the things upto training and fitting the model and my accuracy and validation accuracy are almost 100% but when i try to print classification report and confusion matrix from my model it always shows precision, recall and final accuracy is always 0.01% and confusion matrix is also bizzare. Why is this happenning please help me. Code is available at code section. Thank you.

This is my code for fruit classification


Solution

  • You test data is being shuffled, and that's why the classification report gives lower accuracy. Use

    shuffle=False 
    

    for the test set while predicting, so that, you maintain the order of the prediction, in turn comparing it with the correct ground truth value.