How to creat and plot a confusion matrix of the trained CNN netowork?
Afficher commentaires plus anciens
I have trained a CNN and result showed down but I would need help to find the confusion matrix of the network validation accuracy outcome 

Réponses (1)
Mahesh Taparia
le 23 Fév 2021
0 votes
Hi
To find the confusion matrix, first you have to test the model on testing data and then use plotconfusion function. For more information, you can refer this example. Hope it will help!
10 commentaires
Mohamed Elbeialy
le 27 Fév 2021
Mahesh Taparia
le 28 Fév 2021
Can you share the model prediction and the ground truth data? Or can you share your code?
Mohamed Elbeialy
le 28 Fév 2021
Modifié(e) : Mohamed Elbeialy
le 28 Fév 2021
Mahesh Taparia
le 28 Fév 2021
Try this:
plotconfusion(imdsValidation.Labels,YPred)
Mohamed Elbeialy
le 28 Fév 2021
Mahesh Taparia
le 28 Fév 2021
Are you able to train the network? The trainedNet is the trained network which you have defined as:
trainedNet = trainNetwork(augimdsTrain,layers,options); % train the network
Once training completes, it will be a defined object.
Mohamed Elbeialy
le 10 Avr 2021
Mahesh Taparia
le 12 Avr 2021
You can pass the labels and predictions separately to plotConfusion function for each validation,test and training data. For example, consider below:
[YPredValidation] = classify(trainedNet,augimdsValidation); % classify the validation images
plotconfusion(imdsValidation.Labels,YPredValidation)
[YPredTraining] = classify(trainedNet,augimdsTrain); % classify the training images
plotconfusion(imdsValidation.Labels,YPredTraining)
% Similary for testing dataset
Mohamed Elbeialy
le 2 Mai 2021
R Ramya
le 19 Jan 2022
plotconfusion(YTrain,YPredicted
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!