The output size (100) of the last layer does not match theresponse size (40000).
2 views (last 30 days)
Show older comments
I designed a very simple dnn, whose structure is shown in the figure.
layers = [
%Input Layers
featureInputLayer(40000);
%Hidden Layers
fullyConnectedLayer(256)
reluLayer
fullyConnectedLayer(256)
reluLayer
fullyConnectedLayer(256)
reluLayer
% Output Layers
fullyConnectedLayer(100)
regressionLayer];
And the code i used to generate my trainset —— 2D signals and 2D signals affected by noise, I have put this .m file as an attachment. I want to be able to use neural networks to remove noise from the signal.
When I input my training set to train it, the system prompts me that there is an error.
layers = [
%Input Layers
featureInputLayer(40000);
%Hidden Layers
fullyConnectedLayer(256)
reluLayer
fullyConnectedLayer(256)
reluLayer
fullyConnectedLayer(256)
reluLayer
% Output Layers
fullyConnectedLayer(100)
regressionLayer];
options = trainingOptions('adam', ...
'InitialLearnRate',0.001,...
'LearnRateSchedule','piecewise',...
'LearnRateDropFactor',0.9,...
'LearnRateDropPeriod',40,...
'ExecutionEnvironment', 'cpu', ...
'MiniBatchSize', 32, ...
'MaxEpochs', 500, ...
'ValidationData',{VaSet_o,VaSet_n},...
'L2Regularization',1.0000e-05,...
'Shuffle', 'every-epoch', ...
'Plots', 'training-progress', ...
'Verbose', false);
net = trainNetwork(TrainSet_n, TrainSet_o, layers, options);
Error using trainNetwork
Invalid training data. The output size (100) of the last layer does not match theresponse size (40000).
I am quite sure that the response size of my training set is 100 instead of 40000
OK, then I change the output size to 40000 but didn't modify my train set.
And the system the system told me that another error occurred.
The output size (40000) of the last layer does not match the response size (100).
Now how does the response size change back to 100????
WHY??????????
I really hope someone can help me, please.
This is very important to me.
2 Comments
Matt J
on 17 Feb 2023
Edited: Matt J
on 17 Feb 2023
It does seem strange, but please post your code as formatted text, e.g.,
a=1;
b=2;
instead of as images, so it is easy for us to copy/paste and run it. Also, please attach a subset of your features and response training data in a .mat file so that we can use it to run the code.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Parallel and Cloud 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!