Labeling images using own trained classifier

Hi, I have created a classifier using CNN (vgg16) for the feature extraction and KNN to classify using a dataset made of 1000 images with accuracy of 96% for train and 94% for test. The question is: How can I use my classifier to label one given image? Say I have one image on an apple and I want my classifier to recognize the apple, how can I know the corresponding label of the image (in this case apple)?

What kind of function should I use? predict()?

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

try like this:

newImage = imread(fullfile(rootFolder, 'airplanes', 'image_0690.jpg'));% Create augmentedImageDatastore to automatically resize the image when
% image features are extracted using activations.
ds = augmentedImageDatastore(imageSize, newImage, 'ColorPreprocessing', 'gray2rgb');
% Extract image features using the CNN
imageFeatures = activations(net, ds, featureLayer, 'OutputAs', 'columns');
% Make a prediction using the classifier
label = predict(classifier, imageFeatures, 'ObservationsIn', 'columns')

https://matlabarticlesworld.blogspot.com/2021/05/labeling-images-using-own-trained.html

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.