how can i make alexnet accept 277x277x1 images

32 vues (au cours des 30 derniers jours)
abdo  elsayed
abdo elsayed le 29 Déc 2017
Commenté : Walter Roberson le 22 Jan 2023
i got error in example TransferLearningUsingAlexNetExample Error using trainNetwork (line 140) The training images are of size 227x227x1 but the input layer expects images of size 227x227x3. my dataset 277X277x1
  3 commentaires
arun anoop m
arun anoop m le 17 Juil 2020
a=imread(' ');
l=alexnet;
a=imresize(a,[227 227]);
s=classify(l,a);
imshow(a);
try this.
Eline Geerits
Eline Geerits le 4 Avr 2022
How can I apply this to an DataSet. I have abaout 4000 Images I have to resize so it would take way to long to do this for every Image indevidually.

Connectez-vous pour commenter.

Réponse acceptée

Brendan Hamm
Brendan Hamm le 29 Déc 2017
You can resize an image with the imresize function. Now since your images are of size 277x277x1 I will assume they are grayscale, but AlexNet was trained with RGB values and are thus 227x227x 3. It is not possible for you to recover color information from a grayscale image. You may be required to retrain the entire network with grayscale images.
I suggest for more questions on getting started with Deep Learning you check out the FREE Deep Learning OnRamp: https://matlabacademy.mathworks.com/
  9 commentaires
arun anoop m
arun anoop m le 17 Juil 2020
Thank you Brendan Hamm sir for recommending useful training course Deep Learning Onramp.
Walter Roberson
Walter Roberson le 22 Jan 2023
These days you should use an augmented image datastore as that can automatically resize and automatically convert to gray or rgb.

Connectez-vous pour commenter.

Plus de réponses (3)

Atika Aftab
Atika Aftab le 10 Fév 2020
how can i make [224 224 1] img size ?
  1 commentaire
arun anoop m
arun anoop m le 17 Juil 2020
I hope
a=imread(' ');
a=imresize(a,[224 224]);

Connectez-vous pour commenter.


Ayshath Afra
Ayshath Afra le 2 Avr 2020
The training images are of size 256x256x3 but the input layer expects images of size 224x224x3.
pls help me to solve this error
  1 commentaire
Michael Keeling
Michael Keeling le 5 Juin 2020
Modifié(e) : Michael Keeling le 5 Juin 2020
You can make an augmented datastore of the images that resizes them auomatically, while leaving your raw images the same

Connectez-vous pour commenter.


Zaheer Hussain Fida
Zaheer Hussain Fida le 10 Jan 2023
can we extract the binary images features using alexnet.
  1 commentaire
Walter Roberson
Walter Roberson le 12 Jan 2023
Use https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.transform.html to apply double() to the binary images so that they become grayscale images containing 0 (false) and 1 (true).
Use augmentedImageDatastore to automatically apply any rescaling needed to get the size needed by alexnet, 227 x 227 x 3 -- there is a color conversion option that can be used in the function.
And then hope that alexnet just happens to have been trained on a number of binary images with useful class names, so that instead of classifying as (say) 'Mathworks Screwdriver', it classifies as (say) 'Solidity 0.8 Eccentricity 0.14 MajorAxes 85' .
... But I must admit, I think the chances are low.
I think you would have more success if you used Transfer Learning rather than hoping that alexnet is already able to identify the exact set of binary features that you want.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by