What is the mean of "Error using builtin" when using trainNetwork?

조회 수: 11(최근 30일)
I use the way introduced in this link to train my network, but when I finish creating training data and validation data, it shows a error message below.
Error using trainNetwork (line 170)
Invalid input array.
Error in NetworkTest (line 53)
net = trainNetwork(dsTrain,lgraph,options);
Caused by:
Error using builtin
Invalid input array.
I have no idea how to fix this problem. Is it mean that I create the wrong training data and vadiation data?
Here is my code about training. (I set training data and validation data the same because I only want to test whether the program works or not first)
%read input imag, each mat file is 32*32*20
imdsTrain = imageDatastore('TrainData/*', ...
'FileExtensions','.mat','ReadFcn',@(x) matRead(x));
%read target imag, each mat file is 32*64*20
imdsTarget = imageDatastore('GroundTruth/*', ...
'FileExtensions','.mat','ReadFcn',@(x) matRead(x));
dsTrain = combine(imdsTrain,imdsTarget);
dsVal = combine(imdsTrain,imdsTarget);
imdsTrain.ReadSize = 10;
imdsTarget.ReadSize = 10;
options = trainingOptions('adam', ...
'MaxEpochs',100, ...
'MiniBatchSize',imdsTrain.ReadSize, ...
'ValidationData',dsVal, ...
'Shuffle','never', ...
'Plots','training-progress', ...
'Verbose',false);
net = trainNetwork(dsTrain,lgraph,options); %line 53

답변(1개)

Sourav Bairagya
Sourav Bairagya 2019년 12월 20일
It seems that data stored in the '.mat' file may have some error. Hence, it would be better to check the dimesnions of those data and match those with the input and output size of the network.

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by