フィルターのクリア

How to Load a Single Image For CNN Classification?

4 ビュー (過去 30 日間)
Vinay Chawla
Vinay Chawla 2020 年 9 月 14 日
コメント済み: Vinay Chawla 2020 年 9 月 15 日
Hello,
I have trained a CNN model to predict three clasess and now I want to check the model's performance based on a new data set. I have 7 new images in each category and 21 images altogether. I can add all the images at once and check the prediction based on the code I have now, but I want to add a single image instead of all 21 images, and see the results.
I would appreciate if anyone can assist me.
The lines of code I am using for now to add new images are as follows:
newImage= imageDatastore(rootfoldertest,'IncludeSubfolders',true);
ds = augmentedImageDatastore(inputSize,newImage,'ColorPreprocessing','gray2rgb');
imageFeatures = activations(trainedNet, ds, featurelayer, 'MiniBatchSize', 32,'OutputAs', 'columns');
label = predict(classifier,imageFeatures, 'ObservationsIn','columns');
sprintf('The loaded image belongs to %s class', label);
I tried using the line of code below instead of the one I am using above but it did not work.
newImage = imread(fullfile('*.jpg'));

採用された回答

Deepika Ahlawat
Deepika Ahlawat 2020 年 9 月 15 日
Hi Vinay,
Can you share the error you're getting on trying to access a single image.
To access the single image, you can just provide the location of that image and pass that on to the augmentedImageDatastore function.
newImage = imread('c:\matlab\imagestore\label1\image1.jpg');
ds = augmentedImageDatastore(inputSize,newImage,'ColorPreprocessing','gray2rgb');
  1 件のコメント
Vinay Chawla
Vinay Chawla 2020 年 9 月 15 日
Here is the error when I use the line of code:
newImage = imread(fullfile('*.jpg'));
ERRORS

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by