Why does trainNetwork return an error? - Error using trainNetwork (line 184) Layers argument must be an array of layers or a layer graph.
1 view (last 30 days)
Show older comments
Why does trainNetwork not recognise my layers?
I've tried copy-pasting prebuilt layers from a .mlx tutorial but i'm receiving the same error regardless, even when I turn it into an lgraph,
can anyone explain why this error is occuring...here is my full code,
thanks,
%[xTrain, yTrain, xValidation, yValidation, augTrain, augValid] = trainingDataGetter(1);
load("augTrain.mat");
load("augValid.mat");
load("yTrain.mat");
load("yValid.mat");
layers = [...
imageInputLayer([24 24 3])
convolution3dLayer([12 12 3],8,'Padding',1)
fullyConnectedLayer(1)
regressionLayer
]
lgraph = layerGraph(layers);
miniBatchSize = 128;
validationFrequency = floor(numel(augTrain.Files)/miniBatchSize);
options = trainingOptions('sgdm', ...
'MiniBatchSize',miniBatchSize, ...
'MaxEpochs',30, ...
'InitialLearnRate',1e-3, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropFactor',0.1, ...
'LearnRateDropPeriod',20, ...
'Shuffle','every-epoch', ...
'ValidationData',{augValid,yValidation}, ...
'ValidationFrequency',validationFrequency, ...
'Plots','training-progress', ...
'Verbose',false);
net = trainNetwork(augTrain,yTrain,layers,options);
0 Comments
Answers (0)
See Also
Categories
Find more on Get Started with Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!