Using multiple features in trainNetwork to determine an artist of a painting
Mostra commenti meno recenti
I am using convolutional neural networks to discriminate who is the artist of a painting. I have around 200 images from each artist, all resized to the same size and rgb (so 3 separate color channels). 90% of the images are used as training images and the rest for testing.
When I use trainNetwork I get around 70% accuracy (± 5%). It fluctuates since the selection of the training data i random.
Is it possible to better the accuracy with more "features"? Lets say I use imgradient to find the magnitude and direction of an image. I can use these two separately to train my CNN (just like I would with my original images but magnitude and direction are 2-dimensional data) and I will get different results from using the rgb images. But is it possible to use all 3 in combination to better the accuracy somehow? I hope the question is understandable.
Here is my code if it is needed. I have used this example as a template: https://se.mathworks.com/help/nnet/ref/trainnetwork.html
% Reading the images
digitDatasetPath = fullfile(pwd ,'images', 'NOF', 'XXS');
digitData = imageDatastore(digitDatasetPath,...
'IncludeSubfolders',true,'LabelSource','foldernames');
% Defining the training and testing data
trainingNumFiles = 0.9;
rng(1) % For reproducibility
[trainDigitData,testDigitData] = splitEachLabel(digitData,...
trainingNumFiles, 'randomize');
% Read the size of the image
[n, m, o] = size(digitData.readimage(1));
% Defining the layers
layers = [imageInputLayer([n m o]);
convolution2dLayer(5,20);
reluLayer();
maxPooling2dLayer(2,'Stride',2);
fullyConnectedLayer(2);
softmaxLayer();
classificationLayer()];
% Setting the training options
options = trainingOptions('sgdm','MaxEpochs',20,...
'InitialLearnRate',0.0001, 'ExecutionEnvironment', 'parallel');
% Starting the training
convnet = trainNetwork(trainDigitData,layers,options);
% Testing the result
YTest = classify(convnet,testDigitData);
TTest = testDigitData.Labels;
% Print the result
accuracy = sum(YTest == TTest)/numel(TTest)
% Notify!
beep on
beep
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!