Testing Accuracy for Test Dataset
8 ビュー (過去 30 日間)
古いコメントを表示
How to find testing accuracy for a whole testing dataset of a deep neural network ? Like we use model.evaluate in python, what to use in MATLAB. I have a testing dataset in a folder with 5 categories and images in it.
outputFolder = fullfile('E:\Cifar5categories');
rootFolder = fullfile(outputFolder, 'test');
categories = {'automobile', 'cat', 'dog', 'truck', };
imds = imageDatastore(fullfile(rootFolder,categories),'LabelSource','foldernames');
trainedNetwork_1 is the trained network, trained using Deep Learning Designer. Please tell me the command.
0 件のコメント
回答 (1 件)
Rahul
2024 年 10 月 18 日
I understand that you have a trained network 'trainedNetwork_1', trained using 'Deep Network Designer' and now you require to test its accuracy on the testing dataset.
You can achieve the desired result by using the 'classify' function which takes the trained network and 'imageDatastore' as inputs to obtain the predicted results. Here is an example:
predictedLabels = classify(trainedNetwork_1, imds);
% Here 'trainedNetwork_1' would be the trained network as mentioned
% Here 'imds' would be the 'imageDatastore' of the testing images
Further, you can obtain the accuracy by comparing the predicted labels with the true labels like this:
trueLabels = imds.Labels;
accuracy = mean(predictedLabels == trueLabels);
You can refer to the following MathWorks documentations:
'classify': https://www.mathworks.com/help/releases/R2021a/deeplearning/ref/seriesnetwork.classify.html
Hope this helps! Thanks.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!