Current learning AlexNet Deep Learning, I am pretty sure my image size are correct but it seems that it doesn't acknowledge it.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
The code:
alex = alexnet;
layers = alex.Layers;
layers(23) = fullyConnectedLayer(3);
layers(25) = classificationLayer;
allImages = imageDatastore('common weed images','IncludeSubfolders',true,'LabelSource','foldernames');
[trainingImages, testImages] = splitEachLabel(allImages,0.8,'randomized');
opts = trainingOptions("sgdm",'InitialLearnRate', 0.001 ,'MaxEpochs', 30,'MiniBatchSize', 64);
myNet = trainNetwork(trainingImages, layers, opts);
The ERROR:
Error using trainNetwork
The training images are of size 277×277×3 but the input layer expects images of size 227×227×3.
Error in transferLearning (line 18)
myNet = trainNetwork(trainingImages, layers, opts);
Tried using with augmentedimagedatastore:
alex = alexnet;
layers = alex.Layers;
layers(23) = fullyConnectedLayer(3);
layers(25) = classificationLayer;
allImages = imageDatastore('common weed images','IncludeSubfolders',true,'LabelSource','foldernames');
[trainingImages, testImages] = splitEachLabel(allImages,0.8,'randomized');
trainingImages = augmentedImageDatastore([277 277],trainingImages)
testImages = augmentedImageDatastore([277 277],testImages)
opts = trainingOptions('sgdm', 'InitialLearnRate', 0.001,...
'MaxEpochs', 1, 'MiniBatchSize', 1);
myNet = trainNetwork(trainingImages, layers, opts);
Still has the same ERROR:
Error using trainNetwork
The training images are of size 277×277×3 but the input layer expects images of size 227×227×3.
Error in transferLearning (line 18)
myNet = trainNetwork(trainingImages, layers, opts);
0 Commenti
Risposte (1)
Walter Roberson
il 14 Set 2022
Notice 277 compared to 227.
I suggest that you use an augmentedDatastore to implement automatic resizing to 227
3 Commenti
Walter Roberson
il 14 Set 2022
An augmented store works like a filter on the image data store. You augment the image store.
Vedere anche
Categorie
Scopri di più su Image Data Workflows in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!