Hello everyone!
I'm trying to train an AlexNet model to Feature Extraction and i'm getting the following problems:
I have the following imageDatastore:
imds = imageDatastore(fullfile(path),... 'IncludeSubfolders', true, 'LabelSource', 'foldernames',... 'ReadFcn', @preProcess);
As you can see, i'm using the 'ReadFcn' to make resize over all the images from the data set.
My 'preProcess' function:
image = imread(imgFile); image = imresize(image, [227, 227]);
And my AlexNet model:
net = alexnet; layers = net.Layers; layers(end-2) = fullyConnectedLayer(102); layers(end) = classificationLayer; options = trainingOptions('sgdm', ... 'MaxEpochs', 6, 'MiniBatchSize', 64, 'ExecutionEnvironment', 'GPU'); [mynet, netinfo] = trainNetwork(imds, layers, options);
I'm getting the following error:
Caused by: Error using nnet.internal.cnn.MiniBatchDatasourceDispatcher>iCellTo4DArray (line 328) Unexpected image size: All images must have the same size.
Someone can help me?
Thank you for the support!
Best Answer