Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to find the confusion matrix of a given network?

조회 수: 1 (최근 30일)
GUDIVADA ROKESH  KUMAR
GUDIVADA ROKESH KUMAR 2019년 5월 30일
마감: MATLAB Answer Bot 2021년 8월 20일
%%
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
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 5월 30일
편집: KALYAN ACHARJYA 2019년 6월 3일
At first, it would be better if you go through, what is confusion matrix?

답변 (1개)

Jyotish Kumar
Jyotish Kumar 2019년 6월 3일
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.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by