Problem with image size for AlexNet
Afficher commentaires plus anciens
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!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!