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 Ansicht (letzte 30 Tage)
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

Antworten (1)

Prince Kumar
Prince Kumar am 17 Nov. 2021
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 :

Kategorien

Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by