How do i increse the accuracy for my dataset beyond 78 %?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Vidip
el 7 de Mayo de 2024
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 comentarios
Ver también
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!