Clear Filters
Clear Filters

I'm getting error in deep convolution neural networks

2 views (last 30 days)
Sir, I'm getting error by using the above code.
filename=['D:\MATLAB\R2017a\bin\Deep Learning\imgs'];
imds = imageDatastore(filename,...
'IncludeSubfolders',true,...
'LabelSource','foldernames');
imds.ReadFcn = @(filename)readAndPreprocessImage(filename);
[imdsTrain,imdsTest] = splitEachLabel(imds,0.7,'randomized');
numTrainImages = numel(imdsTrain.Labels);
net = alexnet;
net.Layers
inputSize = net.Layers(1).InputSize
%augimdsTrain = augmentedImageDatastore(inputSize(1:2),imdsTrain);
%TaugimdsTest = augmentedImageDatastore(inputSize(1:2),imdsTest);
label=classify(net,imdsTest)
function Iout = readAndPreprocessImage(filename)
I = imread(filename);
% Some images may be grayscale. Replicate the image 3 times to
% create an RGB image.
if ismatrix(I)
I = cat(3,I,I,I);
end
% Resize the image as required for the CNN.
Iout = imresize(I, [227 227]);
end
My error is Struct contents reference from a non-struct array object. Please resolve the issue as early as possible.

Answers (0)

Community Treasure Hunt

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

Start Hunting!