trainNetwork error Size of Matrix Training Data for CNN Regression
1 次查看(过去 30 天)
显示 更早的评论
Description: I wanna transfer a DnCnn Training network to denoise a new 2-D data But it always send Error: X and Y must have the same number of observations. I only use 1 data to train and reshape the data as a formal dataset but it still did not work Very Need you help
Code: %Load Data load('Synmodule.mat'); load('SynNoise.mat');
Ximds=TraceDataNorm(s,0,1); Yimds = TraceDataNorm(SynNoise,0,1)-Ximds;
%Load Pretrained Network
XNew = zeros(size(Ximds,1),size(Ximds,2),1,1); XNew(:,:,1,1) = Ximds(:,:);
YNew = zeros(size(Yimds,1),size(Yimds,2),1,1); YNew(:,:,1,1) = Yimds(:,:);
net = denoisingNetwork('dncnn'); layers = dnCNNLayers();
%Train Network maxEpochs = 30; initLearningRate = 0.1; l2reg = 0.0001; batchSize = 128;
options = trainingOptions('sgdm',... 'Momentum',0.9,... 'InitialLearnRate',initLearningRate,... 'LearnRateSchedule','piecewise',... 'L2Regularization',l2reg,... 'MiniBatchSize',batchSize,... 'MaxEpochs',maxEpochs,... 'Plots','training-progress');
netTransfer = trainNetwork(XNew,Yimds,layers,options);
Error: nnet.internal.cnn.util.NetworkDataValidator/assertXAndYHaveSameNumberOfObservations (line 142) Invalid training data. X and Y must have the same number of observations.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!