Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to find the confusion matrix of a given network?

1 visualizzazione (ultimi 30 giorni)
GUDIVADA ROKESH  KUMAR
GUDIVADA ROKESH KUMAR il 30 Mag 2019
Chiuso: MATLAB Answer Bot il 20 Ago 2021
%%
Folder = 'C:\Users\Vishal\Desktop\Rokesh\NntestCopy\Bacteria';
if ~isdir(Folder)
Message = sprintf('Error: cant find the folder:\n%s', Folder);
uiwait(warndlg(Message));
else Message = sprintf('Folder exists:\n%s', Folder);
uiwait(warndlg(Message));
return;
end
%%
DataPath = fullfile(Folder)
%%
imgdts = imageDatastore(DataPath,'IncludeSubfolders',true,'LabelSource','foldernames')
%%
imgdts.countEachLabel
%%
trainingNumFiles = 46;
rng(1)
[imgdtsTrain,imgdtsValidation] = splitEachLabel(imgdts,...
trainingNumFiles,'randomize')
%%
layers=[...
imageInputLayer([566 804 3])
convolution2dLayer(5,20,'stride',2)
reluLayer
maxPooling2dLayer(5,'stride',1)
convolution2dLayer(5,20,'stride',2)
reluLayer
maxPooling2dLayer(5,'stride',1)
convolution2dLayer(5,20,'stride',2)
reluLayer
maxPooling2dLayer(5,'stride',1)
convolution2dLayer(5,4,'stride',2,'padding',[1 1])
reluLayer
fullyConnectedLayer(2)
softmaxLayer
classificationLayer()]
%analyzeNetwork(layers)
%%
options = trainingOptions('sgdm',...
'MaxEpochs',25,...
'ValidationData',{imgdtsTrain,imgdtsValidation},...
'ValidationFrequency',2,...
'Momentum',0.8,...
'ValidationPatience',1,...
'InitialLearnRate',0.0001,...
'MiniBatchSize',4,...
'Verbose',true,...
'executionenvironment','auto',...
'Shuffle','every-epoch',...
'Plots','training-progress')
%%
microbenet=trainNetwork(imgdts,layers,options)
%%
i=imread('ccb23.jpg');
figure,imshow(i);
%%
output=classify(microbenet,i)
Here, I have 104 images and then labeled them as four species as a,b,c,d. Each label consists of 26 images. I wanted a confusion matrix of this network.
  1 Commento
KALYAN ACHARJYA
KALYAN ACHARJYA il 30 Mag 2019
Modificato: KALYAN ACHARJYA il 3 Giu 2019
At first, it would be better if you go through, what is confusion matrix?

Risposte (1)

Jyotish Kumar
Jyotish Kumar il 3 Giu 2019
Hi,
The Deep Learning Toolbox in MATLAB has ‘confusion’ and ‘plotconfusion’ functions to extract the confusion matrix. Please go through the following links for more details:
I hope it will help you.

Questa domanda è chiusa.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by