How do i increse the accuracy for my dataset beyond 78 %?
1 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(1 个)
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 –
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!