Error in running 1d cnn

1 次查看(过去 30 天)
TRISHITA BANERJEE
TRISHITA BANERJEE 2019-5-15
% 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.

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by