Error in running 1d cnn

1 Ansicht (letzte 30 Tage)
TRISHITA BANERJEE
TRISHITA BANERJEE am 15 Mai 2019
Beantwortet: Shengjie Ren am 13 Jun. 2020
% Train Basic 1D-CNN %
% Prepare XTrain,YTrain (signal,label)
%% TODO %%
XTrain = load('D:\Trishita\VAD_NN\voicedregion_signal');
YTrain= load('D:\Trishita\VAD_NN\voicedregion_label');
chunklength = 1000;
% numberofchunks = floor(length(XTrain)/chunklength);
numberofchunks = 1;
XTrain = reshape(XTrain(1:numberofchunks*chunklength),chunklength,1,numberofchunks);
YTrain = reshape(YTrain(1:numberofchunks*chunklength),chunklength,1,numberofchunks);
XValidation = load('D:\Trishita\VAD_NN\voicedregion_signal');
YValidation= load('D:\Trishita\VAD_NN\voicedregion_label');
chunklength = 1000;
% numberofchunks = floor(length(XValidation)/chunklength);
numberofchunks = 1;
XValidation = reshape(XValidation(1:numberofchunks*chunklength),chunklength,1,1,numberofchunks);
YValidation = reshape(YValidation(1:numberofchunks*chunklength),chunklength,1,1,numberofchunks);
% define network %
layers = [
% input signal chunk - 1000x1
imageInputLayer([1000 1 1])
convolution2dLayer([3,1],1,'Padding','same')
reluLayer
convolution2dLayer([3,1],32,'Padding','same')
reluLayer
convolution2dLayer([3,1],32,'Padding','same')
reluLayer
convolution2dLayer([3,1],32,'Padding','same')
reluLayer
fullyConnectedLayer(1000)
regressionLayer
];
% define training options
miniBatchSize = 128;
validationFrequency = 8000;
options = trainingOptions('sgdm', ...
'MiniBatchSize',miniBatchSize, ...
'MaxEpochs',30, ...
'InitialLearnRate',1e-3, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropFactor',0.1, ...
'LearnRateDropPeriod',20, ...
'Shuffle','every-epoch', ...
'ValidationData',{XValidation,YValidation}, ...
'ValidationFrequency',validationFrequency, ...
'Plots','training-progress', ...
'Verbose',false);
% train and wait
net = trainNetwork(XTrain,YTrain,layers,options);
My error is: XTrain =
reshape(XTrain(1:numberofchunks*chunklength),chunklength,1,numberofchunks);
>> BasicCNN
Index exceeds array bounds.

Antworten (1)

Shengjie Ren
Shengjie Ren am 13 Jun. 2020
Is the matlab program of 1D-CNN implemented? Is it easy to share? Thank you so much.1653482142@qq.com

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by