How to creat and plot a confusion matrix of the trained CNN netowork?
Ältere Kommentare anzeigen
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 

Antworten (1)
Mahesh Taparia
am 23 Feb. 2021
0 Stimmen
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 Kommentare
Mohamed Elbeialy
am 27 Feb. 2021
Mahesh Taparia
am 28 Feb. 2021
Can you share the model prediction and the ground truth data? Or can you share your code?
Mohamed Elbeialy
am 28 Feb. 2021
Bearbeitet: Mohamed Elbeialy
am 28 Feb. 2021
Mahesh Taparia
am 28 Feb. 2021
Try this:
plotconfusion(imdsValidation.Labels,YPred)
Mohamed Elbeialy
am 28 Feb. 2021
Mahesh Taparia
am 28 Feb. 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
am 10 Apr. 2021
Mahesh Taparia
am 12 Apr. 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
am 2 Mai 2021
R Ramya
am 19 Jan. 2022
plotconfusion(YTrain,YPredicted
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!