incorrect matrix size while training data
1 回表示 (過去 30 日間)
古いコメントを表示
I am training a neural network with input [25x1x1].
I am taking input using imageInputLayer([25 1]).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/317670/image.png)
My training data is sotred in the variable images which is of size [25x1x1x80000].
But when I run the program to train the network I get an error:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/317673/image.png)
I dont know what is causing this error. My input dimensions match with the dimensions of my training data and everything else in the network seems fine.
Please help.
5 件のコメント
回答 (1 件)
Raynier Suresh
2021 年 2 月 17 日
Hi, check whether you have defined the architecture of your network correctly, you can do this by using the command "analyzeNetwork(layers)". For input layer size [25 1] and the training data size [25 1 1 80000] the trainNetwork function should work fine for example you can refer the code below.
layers = [imageInputLayer([25 1])
convolution2dLayer(1,32)
reluLayer
fullyConnectedLayer(4)
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm', ...
'MaxEpochs',1,...
'InitialLearnRate',1e-4, ...
'Verbose',false, ...
'Plots','training-progress');
Xtrain = rand(25,1,1,80000);
Ytrain = categorical(randi(4,80000,1));
net = trainNetwork(Xtrain,Ytrain,layers,options);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!