How can I see the predicted labels for all my validation set images? I used deep network designer to modify a pre-trained network .

1 次查看(过去 30 天)
Hi,
So I used Deep Network Designer ( DND) to modify GoogleNet and do some transfer learning on a new dataset. I separated the data into training vs validation, again using the DND. When the transfer learning process has ended, I obtained an accuracy of 97. Now, my issue is the deployment of the results. I need a code that gives me a file with all the images and the predcited class and its percentage.
For the moment I only have this
idx = randperm(numel(imdsValidation.Files),4);
figure
for i = 1:4
subplot(2,2,i)
I = readimage(imdsValidation,idx(i));
imshow(I)
label = YPred(idx(i));
title(string(label) + ", " + num2str(100*max(probs(idx(i),:)),3) + "%");
end
But obsly if I adapted it for hundreds of images does not work.
Please let us know if there is any possibility to deploy all the validation images with the class predicted.
Thanks a lot,
Andreea

回答(1 个)

Prince Kumar
Prince Kumar 2021-11-17
You can pass all the validation set as a batch to get the all predictions at once instead of doing it one by one.
For example:
[YPred,probs] = classify(net,imdsValidation);
Here net can be any network which you trained.
For a full example you can have a look at this link :

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by