classification using CNN (trainNetwork)

조회 수: 1 (최근 30일)
Toqa Am
Toqa Am 2019년 11월 20일
Why the validation accuracy of CNN using trainNetwork has been change in each rerun. It has been decreased from 89% to 39% in each re run the program.
Please could anyone answer me???
close all, clear all, clc;
output_folder=fullfile('datasets - Copy (2)','REMBRANDT') ; %creat file path
categories={'Grade_II - Copy','Grade_III - Copy','Grade_IV - Copy'};
imds=imageDatastore((fullfile(output_folder,categories)),'FileExtensions','.dcm','ReadFcn',@(x) dicomread(x),'LabelSource','foldernames');
[trainingset, testset]=splitEachLabel(imds, 0.8,0.2);
labelCount = countEachLabel(imds);
rng(1);
layers = [
imageInputLayer([128 128 1])
convolution2dLayer(3,8,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(1,'Stride',1)
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(1,'Stride',1)
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(3)
dropoutLayer
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.01, ...
'MaxEpochs',40, ...
'Shuffle','every-epoch', ...
'ValidationData',testset, ...
'ValidationFrequency',60, ...
'Verbose',false, ...
'Plots','training-progress');
net = trainNetwork(trainingset,layers,options);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by