Encountered an error while implementing deep learning regression model in MATLAB.
조회 수: 3 (최근 30일)
이전 댓글 표시
Following is the code and the error generated while implementing regression model in MATLAB. input vector(traindata(:,1)) is of size 300 and output vector(traindata(:,2)) size is also 300, still I am getting error of size not same. traindata is a cell of size 769x2 each element of length 1x300 double. what am I doing wrong?
load('traindata.mat')
load('testdata.mat')
layers1 = [
sequenceInputLayer(1,MinLength = 300)
convolution1dLayer(4,3,Padding="same",Stride=1)
convolution1dLayer(64,8,Padding="same",Stride=8)
batchNormalizationLayer()
tanhLayer
maxPooling1dLayer(2,Padding="same")
convolution1dLayer(32,8,Padding="same",Stride=4)
batchNormalizationLayer
tanhLayer
maxPooling1dLayer(2,Padding="same")
transposedConv1dLayer(32,8,Cropping="same",Stride=4)
tanhLayer
transposedConv1dLayer(64,8,Cropping="same",Stride=8)
tanhLayer
bilstmLayer(8)
fullyConnectedLayer(8)
dropoutLayer(0.2)
fullyConnectedLayer(4)
dropoutLayer(0.2)
fullyConnectedLayer(1)
regressionLayer];
options = trainingOptions("adam",...
MaxEpochs=600,...
MiniBatchSize=600,...
InitialLearnRate=0.001,...
ValidationData={valdata(:,1),valdata(:,2)},...
ValidationFrequency=100,...
VerboseFrequency=100,...
Verbose=1, ...
Shuffle="every-epoch",...
Plots="none", ...
DispatchInBackground=true);
[net1,info1] = trainNetwork(traindata(:,1),traindata(:,2),layers1,options);
댓글 수: 1
채택된 답변
Sanjana
2023년 3월 30일
Hi,
I understand that you are facing an issue with incompatible input and output sequence lengths,
The above error, is not related to the data as , the input and output data shapes are correct, But if you execute the “analyzeNetwork(layers1)”, from here we can understand the output from the “regressionLayer” has a sequence length of 32 and input layer has a sequence length of 1,this is because of the network architecture you defined. So,I suggest you to try to make changes to the architecture according to your task.
Please refer to the below link for further information,
Hope this helps!
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!