MATLAB Answers

I am getting 0 percent accuracy when using 3-fold cross validation

조회 수: 1(최근 30일)
user06
user06 27 Feb 2019
편집: user06 27 Feb 2019
I want to train a CNN that will be k-fold cross-validated. for that, I have divided my signature data set in three equal part. using the two parts training is happening and from the remaining part, testing will be performed. this process will be done three times as k=3. I am using 3-fold cross validation in Matlab. but when I test the network it is giving 0% accuracy how it can be possible. can someone please help me what is the mistake I am making?
k = 3; % number of folds
datastore = imageDatastore(fullfile('/media/titan/ACER DATA/GPDS300'), 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
partStores{k} = [];
for i = 1:k
temp = partition(datastore, k, i);
partStores{i} = temp.Files;
end
layers = [imageInputLayer([64 128 3]);
convolution2dLayer(7,40);
reluLayer();
fullyConnectedLayer(200);
softmaxLayer();
classificationLayer()];
options = trainingOptions('sgdm','MaxEpochs',150,'minibatchsize',32,'InitialLearnRate',0.001);
for i = 1:k
test_idx = (idx == i);
train_idx = ~test_idx;
test_Store = imageDatastore(partStores{test_idx}, 'IncludeSubfolders', true,
'LabelSource', 'foldernames');
train_Store = imageDatastore(cat(1, partStores{train_idx}),
'IncludeSubfolders', true, 'LabelSource', 'foldernames');
net{i} = trainNetwork(train_Store, layers, options);
pred{i} = classify(net{i}, test_Store);
TTest=test_Store.Labels;
accuracyn{i} = sum(pred{i} == TTest)/numel(TTest)
end

  댓글 수: 0

로그인 to comment.

답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by