Why I cannot use Alexnet on my images dataset

3 views (last 30 days)
Hiba Basim Alwan
Hiba Basim Alwan on 27 Jan 2018
Answered: Rasaq Kotun on 12 Feb 2019
clc;
clear;
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;
net.Layers;
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
  5 Comments

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?
  2 Comments
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.
Regards,
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