I am trying to classify two class of images with resnet-50 in deep learning and getting an error 'No appropriate method, property, or field 'Lables' for class 'matlab.io.datastore.ImageDatastore'..
Can anyone help. This is my code
clc
%%Image Folder%%
outputFolder = fullfile('input folder');rootFolder = fullfile(outputFolder, 'CNN_Class');categories = {'a','b'}; %%Datastore for storing the images%%
imds = imageDatastore(fullfile(rootFolder, categories),'LabelSource', 'foldernames');tbl=countEachLabel(imds);minSetcount=min(tbl{:,2});imds=splitEachLabel(imds,minSetcount,'randomize');countEachLabel(imds); net=resnet50();set(gca,'YLim',[150 170]);net.Layers(1);net.Layers(end);numel(net.Layers(end).ClassNames);%%Split into Training and Testing set%%
[trainingSet,testSet] = splitEachLabel(imds,0.8,'randomized');imageSize=(net.Layers(1).InputSize);augmentedTrainingset=augmentedImageDatastore(imageSize,trainingSet);augmentedTestset=augmentedImageDatastore(imageSize,testSet);w1=net.Layers(2).Weights;w1=mat2gray(w1);% figure
%montage(w1)
title('First Convolution Layer Weight')featureLayer='fc1000';trainingFeatures=activations(net,augmentedTrainingset,... featureLayer,'MiniBatchSize',32,'OutputAs','Columns');trainingLabels=trainingSet.Labels;Classifier=fitcecoc(trainingFeatures,trainingLabels,... 'Learner','Linear','Coding','onevsall','ObservationsIn','Columns');testFeatures=activations(net,augmentedTestset,... featureLayer,'MiniBatchSize',32,'OutputAs','Columns');predictLabels=predict(Classifier,testFeatures,'ObservationsIn','Columns');testLables=testSet.Lables;confMat=confusionmat(testLables,predictLables);confMat=bsxfun(@rdivide,confMat,sum(confMat,2));mean(diag(confMat))
Best Answer