how to define sequence input layer and fully connected layer for CNN for multivariate data in matab
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Pratyush Roy
il 20 Gen 2022
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?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Image Data Workflows in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!