Error in running 1d cnn

1 回表示 (過去 30 日間)
TRISHITA BANERJEE
TRISHITA BANERJEE 2019 年 5 月 15 日
回答済み: Shengjie Ren 2020 年 6 月 13 日
% 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 Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by