% first, the hyperparameters, you will need to play with these train_percent = 0.90; % amount from each label to use in training, if you want to do cross validation let me know % test perc = 1 - train mini_batch = 256; % more is faster, limited by gpu memory if you have a gpu max_epochs = 30; initial_learn_rate = 0.001; learn_rate_drop_period = 30; % reduce this if you decide you want to drop the learn rate learn_rate_drop_factor = 0.1; momentum = 0.9; l2reg = 0.00001; validation_freq = 256; % in iterations validation_patience = 3; % early stopping verbose = false; augmentedResolution = [128 128]; % or whatever image resolution you want to use inputResolution = augmentedResolution; inputResolution(3) = 3; % color dimension, set to 1 for black/white images layers = [imageInputLayer(inputResolution); convolution2dLayer(3,32,'Stride',1,'Padding',1); % first number is color dimension, second number is number of neurons/ filters to use (this can be set to whatever positive integer you want, more requiring more computations and memory and parameters - so more means greater chance of overfitting), stride and padding set to 1 ensure that the output resolution is the same as the input resolution batchNormalizationLayer(); % if r2017b supports it reluLayer(); maxPooling2dLayer(2,'Stride',2); dropoutLayer(0.5); % reduces overfitting fullyConnectedLayer(2); % set "2" to number of classes softmaxLayer(); classificationLayer()]; augmenter = imageDataAugmenter('RandRotation', [-10 10]); % optional, used to augment data, see documentation for full options % now getting everything in place and ready to run datastore = imageDatastore(fullfile('.'), 'IncludeSubFolders', true, 'LabelSource', 'foldernames'); % you need to run Matlab from where you folders are located for this to work [trainStore, validStore] = splitEachLabel(datastore, train_percent); trainStoreAug = augmentedImageDatastore(augmentedResolution, trainStore, 'DataAugmentation', augmenter); options = trainingOptions('sgdm', 'MiniBatchSize', mini_batch_size, ... 'LearnRateSchedule', 'piecewise', 'MaxEpochs', max_epochs, 'InitialLearnRate', initial_learn_rate, ... 'LearnRateDropPeriod', learn_rate_drop_period, ... 'LearnRateDropFactor', learn_rate_drop_factor, ... 'L2Regularization', l2reg, 'Momentum', momentum, ... 'Verbose', verbose, 'VerboseFrequency', validation_freq, ... 'ValidationFrequency', validation_freq, 'ValidationData', validStore, ... 'ValidationPatience', validation_patience, 'Plots', 'training-progess'); convnet = trainNetwork(trainStoreAug, layers, options);
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.