Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
How to find the confusion matrix of a given network?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
%%
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 Kommentar
KALYAN ACHARJYA
am 30 Mai 2019
Bearbeitet: KALYAN ACHARJYA
am 3 Jun. 2019
At first, it would be better if you go through, what is confusion matrix?
Antworten (1)
Jyotish Kumar
am 3 Jun. 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.
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!