Labeling images using own trained classifier
1 回表示 (過去 30 日間)
古いコメントを表示
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()?
採用された回答
Image Analyst
2018 年 8 月 25 日
Yes. You can do 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')
4 件のコメント
Patricia-Carmen Tibre
2020 年 5 月 8 日
編集済み: Patricia-Carmen Tibre
2020 年 5 月 8 日
Hello Mr. Image Analyst!
I kinda have the same problem of image labeling. I have to make the classification using SVM and I used CNN to extract features from images. I also have to random the features extracted ( by columns because 1 column = 1 image features ) and when i do that the classification is wrong. Can you give me some tips? I`m thinking that maybe i should have label the columns not the images but maybe I`m wrong. Thank you!
Image Analyst
2020 年 5 月 8 日
So you used CNN (or I guess RCNN) to collect a bunch of estimated feature values (for example x, y, meanGrayLevel, standard deviation) from a set of images, and now you want to randomize that feature matrix. I guess the feature matrix has image numbers going down the rows, and each feature is in its own column, right? And did you also do a classification CNN (the usual, standard, simplest kind) to get an estimated class for each image? And the predicted class is one column of your feature matrix. So your feature matrix is like
image# predictedClass x y meanGrayLevel StdDev
image1 1 5 8 200 2.5
image2 2 9 3 120 4.9
image3 1 4 6 189 8.4
or something like that?
You can use the randsample() function to extract a subset of your matrix.
Or you can get a random ordering yourself using the randperm() function to scramble the order
sortOrder = randperm(size(featureMatrix, 1));
featureMatrix = featureMatrix(sortOrder, :);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Recognition, Object Detection, and Semantic Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!