how to define sequence input layer and fully connected layer for CNN for multivariate data in matab

조회 수: 1 (최근 30일)
Hi,
I am trying to do CNN with two dimensional data , below is my code for layers , i am getting error .
Error using trainNetwork (line 165)
Invalid training data. Sequence responses must have the same sequence length as the corresponding
predictors.
Error in Multivariate (line 73)
net = trainNetwork(pn,tn,layers,options);
Please help me to understand the mistake:
XTrain is 1x515
YTrain is 1x515
XTest is 1x212
YTest is 1x212
below is my code :
numFeatures = 1;
numResponses = 1;
numHiddenUnits1 = 50;
FiltZise = 5;
layers = [...
sequenceInputLayer([numFeatures 515 1],'Name','input')
sequenceFoldingLayer('Name','fold')
convolution2dLayer(FiltZise,256,'Padding','same','WeightsInitializer','he','Name','conv','DilationFactor',1);
batchNormalizationLayer('Name','bn')
reluLayer('Name','relu')
convolution2dLayer(FiltZise,256,'Padding','same','WeightsInitializer','he','Name','conv1','DilationFactor',2);
reluLayer('Name','relu1')
averagePooling2dLayer(1,'Stride',FiltZise,'Name','pool1')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flatten')
fullyConnectedLayer(numResponses,'Name','fc')
regressionLayer('Name','output') ];
layers = layerGraph(layers);
layers= connectLayers(layers,'fold/miniBatchSize','unfold/miniBatchSize');
options = trainingOptions('adam','MaxEpochs',150,'MiniBatchSize',15,'GradientThreshold',1,'InitialLearnRate',0.005,'LearnRateSchedule','piecewise','LearnRateDropPeriod',125,'LearnRateDropFactor',0.2,'Verbose',0, 'Plots','training-progress');
net = trainNetwork(pn,tn,layers,options);
  댓글 수: 1
Pratyush Roy
Pratyush Roy 2022년 1월 20일
Hi Neethu,
In order to assist you better with your query, can you please let me know where the variable "numHiddenUnits1" is used while creating the network?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by