How to test transfer learning outcomes on a different dataset in Deep Learning Pretrained Networks
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
So I have used the Deep Learning Toolbox on MATLAB to transfer learn the GoogLeNet network onto a database of my choice. I have got the network working well, as shown by the training process shown below:
I used this MathWorks page for directions for the majority of this code: Train Deep Learning Network to Classify New Images - MATLAB & Simulink - MathWorks United Kingdom
This page includes a validation section of code at the bottom where it tests object recognition and the accuracy of the recognition. However, this does this in the same piece of code as the training of the network.
I am wondering if there is any other way to export the newly trained network so that when I need to test it for different kinds of images, I dont have to train the entire model every time.
Thanks for any help in advance.
0 Commenti
Risposta accettata
Varun Sai Alaparthi
il 19 Gen 2023
Hello Ted,
I understand that you are looking for ways to export your trained model and test it on new images. You can use the ‘save’ and ‘load’ commands to achieve this.
outputDir = "path_to_dir";
outputFile = fullfile(outputDir, "gnet.mat");
save(outputFile, "net");
By running this script your ‘googlenet’ will be saved in the location specified in ‘outputDir’ variable with name "gnet.mat".
Now you can export this and load in the location you want using the following script in the location
load("gnet.mat");
Now your ‘net’ variable will be present in your workspace, and you can directly use it in your prediction function.
If you have any further queries, please feel free to reply to my answer.
Sincerely,
Varun
3 Commenti
Varun Sai Alaparthi
il 27 Gen 2023
Hello Ted,
If you are saving weights with name 'GoogLeNet.mat'
Then you have to follow the below workflow
load 'GoogLeNet.mat'
[YPred,probs] = classify(net,I);
Because once you load the mat file your network would be present as 'net' object in the workspace.
If you have any further queries, please feel free to reply to my answer.
Sincerely,
Varun
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!