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

22 visualizaciones (últimos 30 días)
jhe en lin
jhe en lin el 17 de Dic. de 2019
Respondida: Sourav Bairagya el 20 de Dic. de 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

Respuestas (1)

Sourav Bairagya
Sourav Bairagya el 20 de Dic. de 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.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by