Error : The prediction sequences are of feature dimension 1 but the input layer expects sequences of feature dimension 4
9 次查看(过去 30 天)
显示 更早的评论
I made this simple network for multiple inputs and single output regression.
![net0.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235072/net0.png)
This is the code I used. I attached the model file.(net_0.mat)
%Question
Question = [0.3 0.4623115577889447 0.591304347826087 4.605170185988092];
obsDia_norm = Question(1);
obsCenterX_log = Question(2);
obsCenterY_log = Question(3);
freq_log = Question(4);
load net_0 %please download it from the attachment.
analyzeNetwork(net_0)
assembledNet = assembleNetwork(net_0)
XTest = Question;
YPred = predict(assembledNet,XTest);
It shows this error.
Error using nnet.internal.cnn.util.NetworkDataValidator/assertValidSequenceInput (line 427)
The prediction sequences are of feature dimension 1 but the input layer expects sequences of
feature dimension 4.
Error in nnet.internal.cnn.util.NetworkDataValidator/validateDataForPredict (line 83)
this.assertValidSequenceInput( X, inputSize );
Error in DAGNetwork/predictRNN (line 7)
dataValidator.validateDataForPredict(data, dispatcher, this.NetworkInfo);
Error in DAGNetwork/predict>predictBatch (line 245)
Y = net.predictRNN(X, dispatcher, precision, predictNetwork, gpuShouldBeUsed);
Error in DAGNetwork/predict (line 118)
Y = predictBatch( ...
Error in Main2_Restore_and_Estimation (line 23)
YPred = predict(assembledNet,XTest);
Q1. I don't understand this error message :
The prediction sequences are of feature dimension 1 but the input layer expects sequences of
feature dimension 4.
What should I change?
Q2. I'm not sure if it's right to use sequence layer.
In my data set, the four inputs are not a sequence. they are just independant variables.
(exactly the four inputs are diameter, x position, y position and frequency.)
But I can't find the other option. As I found there are just two input layers : sequenceInputLayer and imageInputLayer.
Is it okay to use sequenceInputLayer in this case?
Q3. I just want to get an output as a result of the 'FC_out' layer. I don't want to get a MSE from the regression output layer.
But If I remove the regression output layer, it shows me this error.
What can I use to get a output of 'FC_out' layer?
Caused by:
Network: Missing output layer. The network must have one output layer.
Layer 'FC_out': Unused output. Each layer output must be connected to the input of another
layer.
Layer 'Input': Empty AverageImage property. For an image input layer with 'zerocenter'
normalization, specify the average image using the AverageImage property.
0 个评论
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!