フィルターのクリア

Encountered an error while implementing deep learning regression model in MATLAB.

3 ビュー (過去 30 日間)
Abinas Chopdar
Abinas Chopdar 2023 年 2 月 25 日
回答済み: Sanjana 2023 年 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);
Error using trainNetwork
Invalid network.

Caused by:
Network: Incompatible input and output sequence lengths. The network must return sequences with the same length as the input data or a sequence with length one.

採用された回答

Sanjana
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 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by