The output size (100) of the last layer does not match theresponse size (40000).
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Matt J
el 17 de Feb. de 2023
Editada: Matt J
el 17 de Feb. de 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.
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Parallel and Cloud en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!