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

1 Ansicht (letzte 30 Tage)
jhe en lin
jhe en lin am 17 Dez. 2019
Beantwortet: Sourav Bairagya am 20 Dez. 2019
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

Antworten (1)

Sourav Bairagya
Sourav Bairagya am 20 Dez. 2019
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.

Kategorien

Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by