Loading mnist:
I load MNIST by this:
filenameImagesTrain = 'train-images-idx3-ubyte.gz';
filenameLabelsTrain = 'train-labels-idx1-ubyte.gz';
XTrain = processImagesMNIST(filenameImagesTrain);
YTrain = processLabelsMNIST(filenameLabelsTrain);
By running whos XTrain and YTrain,
XTrain size: 28 28 1 6000, class: dlarray, YTrain size: 60000 1, class: categorical.
Training network
I define a layers as the Convolutional neural network.
When I run the training,
net = trainNetwork(XTrain, YTrain, layers, options);
It throws the error:
Invalid 2-D image training data. Specify image data as a 3-D numeric array containing a single image, a 4-D numeric array containing multiple images, a datastore, or a table containing image file paths or images in the first column.
But XTrain is indeed 4-d array.
What's the problem here?