How to read a single image from a folder and then classify it with a trained neural network?
6 ビュー (過去 30 日間)
古いコメントを表示
I trained my network for skin tumor classification and then saved it. Now I want to test the accuracy for some new images. It works fine using imageDatastore but what I really want is to be able to browse in my computer for an image and classify it using the trained network. Is this possible?
Below I have attached the test code for a set of images.
load incercare.mat
imds= imageDatastore('E:/LICENTA/BD_Skin_Cancer_Screening/mini_data/test/', ...
'IncludeSubfolders', true, ...
'LabelSource', 'foldernames' );
[YPred,probs] = classify(netTransfer,imds);
accuracy = mean(YPred == imds.Labels)
for i=1:10
subplot(2,5,i)
I = readimage(imds,idx(i));
imshow(I)
label = YPred(idx(i));
title(string(label) + ", " + num2str(100*max(probs(idx(i),:)),3) + "%");
end
1 件のコメント
Amit
2021 年 6 月 5 日
Dear Malina,
Accoridng to me Backpropagation Feedforward neural network would be best suited for your purpose.
Please send me your 'incercare.mat' file by email on amit.kenjale@gmail.com, I will analyze this file for its variables and suggest you best suited approach to get your work done..
回答 (1 件)
Prateek Rai
2021 年 8 月 16 日
To my understanding, you trained the network for skin tumor classification and want to classify a single image using the trained network.
A possible workaround is:
- Step 1: Read the image.
image = imread(xyz) % xyz is the location of the image in computer.
- Step 2: You can use use the nework variable and feed the image as its argument to compute the network output.
classificationOutput = netTransfer(image);
You can also refer to Classify Patterns with a Neural Network MathWorks documentation page to find more on classification with a neural network.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!