Why I cannot use Alexnet on my images dataset

1 view (last 30 days)
images = imageDatastore('C:\Users\HIBA\Documents\Cancellable Biometrics\Datasets\NIST Faces 1','IncludeSubfolders',true,'LabelSource','foldernames');
[trainingImages,testingImages] = splitEachLabel(images,0.7,'randomized');
net = alexnet;
layer = 'fc7';
trainingFeatures = activations(net,trainingImages,layer,'outputAs','channels');
testFeatures = activations(net,testingImages,layer);

Answers (3)

Walter Roberson
Walter Roberson on 28 Jan 2018
alexnet needs R2016b or later, and requires Neural Network toolbox and requires Neural Network Toolbox Model for AlexNet Network support package

Sign in to comment.

Rabia Afzal
Rabia Afzal on 4 Feb 2018
i'm also facing the same issue. Can anyone help me in my code?
Hiba Basim Alwan
Hiba Basim Alwan on 6 Feb 2018
Dear Rabia Afzal
I run the code provided by Walter Roberson and I found that my images is not on the accepted size stated by Alexnet ([227, 227, 3], but in your mind that your images should be color images with three channels). So, I embedded the below code found on Matlab Answers in my program to fix all my images size to 227, 227.
images_set.ReadFcn=@(images_set)imresize(imread(images_set),[227 227]);

Sign in to comment.

Rasaq Kotun
Rasaq Kotun on 12 Feb 2019
i used this and changed the dimensions to 227 x 277 and worked perfectsly

Community Treasure Hunt

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

Start Hunting!

Translated by