The output size (100) of the last layer does not match theresponse size (40000).
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Matt J
2023년 2월 17일
편집: Matt J
2023년 2월 17일
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.
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel and Cloud에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!