how does it possible in convnet, High accuracy in both of validation and test the same has 97% with error loss function 0.01

3 visualizaciones (últimos 30 días)
i really need an experience help . i feel misunderstand about convolution neural network i have a medical image data set and i want to use a pretrained alexnet so i wrote this code in matlab ( very simple code) myimages='D:\ ';
allimages=imageDatastore(myimages,'IncludeSubfolders',true,'FileExtensions','.png','LabelSource','foldernames');
allimages.ReadFcn= @(filename)readAndPreprocessImage(filename);
[trainingimages,valDigitData,testimage]=splitEachLabel(allimages,0.4,0.2,'randomize');
net= alexnet; layersTransfer = net.Layers(2:end-3);
here i just used layers from 2
%% my layers Layers =[... imageInputLayer([227 227 3],'Name','input') layersTransfer
fullyConnectedLayer(2,'Name','FC_3','WeightLearnRateFactor',20,'BiasLearnRateFactor',20) softmaxLayer('Name','prob') classificationLayer('Name','coutput')];
Layers(23).Weights = randn([2 9216]) * 0.0001;
Layers(23).Bias = randn([2 1])*0.0001 + 1;
opts=trainingOptions('sgdm','Initiallearnrate',0.0001,'maxEpoch',5, 'Minibatchsize',256,'L2Regularization',0.0001, 'Plots','training-progress','ValidationData',valDigitData,'ValidationFrequency',50,'LearnRateSchedule','piecewise','LearnRateDropFactor',0.1,'LearnRateDropPeriod', 1);
%% Re_train the network [trainedNet,traininfo] = trainNetwork(trainingimages,Layers,opts);
%% Classify test Images [predictedlabels,error_test]=classify(trainedNet,testimage);
accuracy= mean(predictedlabels== testimage.Labels);
my concern about i got the same accuracy 97% in valid and test how it can be and error is 0.01 . is this code correct (good work)does the code indeed classify my medical images or ( the alexnet images ) or what ? did i misunderstand something?

Respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by