How do i increse the accuracy for my dataset beyond 78 %?

조회 수: 1 (최근 30일)
Atiya latif
Atiya latif 2021년 1월 27일
답변: Vidip 2024년 5월 7일
imds = imageDatastore('ck_dataset', ...
'IncludeSubfolders',true,'LabelSource','foldernames')
[imdstrain, imdsvalid, imdstest]=splitEachLabel(imds,.8, 0.1);
aTest = augmentedImageDatastore([48 48], imdstest, 'ColorPreprocessing','gray2rgb')
CountLabel = imds.countEachLabel
aa=read(imds);
size(aa)
net = alexnet
layers = [
imageInputLayer([48 48 1])
convolution2dLayer(3,8,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(5)
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.001, ...
'MaxEpochs',15, ...
'Shuffle','every-epoch', ...
'ValidationFrequency',50, ...
'MiniBatchSize',32,...
'Verbose',false, ...
'Plots','training-progress');
convnet = trainNetwork(imdstrain,layers,options);
YPred = classify(convnet,imdsvalid);
YValidation = imdsvalid.Labels;
accuracy = sum(YPred == YValidation)/numel(YValidation)
plotconfusion(YValidation,YPred)

답변 (1개)

Vidip
Vidip 2024년 5월 7일
Improving the accuracy of a model, especially one based on convolutional neural networks (CNNs) like in your case, can be approached from several angles like data augmentation, it artificially increases the size and variability of your training dataset by applying a series of transformations (e.g., rotations, translations, flipping, scaling, etc.), you can use ‘imageDataAugmenter’ as it configures a set of preprocessing options for image augmentation, such as resizing, rotation, and reflection. This can help the model generalize better. Also, consider adding or removing layers accordingly, hyperparameter tuning and transfer learning.
For more information, you can refer to the documentation links below –

카테고리

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