Effacer les filtres
Effacer les filtres

The output size (100) of the last layer does not match theresponse size (40000).

2 vues (au cours des 30 derniers jours)
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 validation data. The output size (100) of the last layer does not match the response size (40000).
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 commentaires
Matt J
Matt J le 17 Fév 2023
Modifié(e) : Matt J le 17 Fév 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.
承显 郑
承显 郑 le 18 Fév 2023
Thank you very much for your answer, I have revised my question, it would be great if you could help me on that basis

Connectez-vous pour commenter.

Réponse acceptée

承显 郑
承显 郑 le 18 Fév 2023
After the problem was solved, I calmed down and thought about it again. I found that the two inputs in the option as the validation set were backfilled.

Plus de réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by