How to test transfer learning outcomes on a different dataset in Deep Learning Pretrained Networks

1 回表示 (過去 30 日間)
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.

採用された回答

Varun Sai Alaparthi
Varun Sai Alaparthi 2023 年 1 月 19 日
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 件のコメント
Varun Sai Alaparthi
Varun Sai Alaparthi 2023 年 1 月 27 日
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
Ted
Ted 2023 年 1 月 28 日
Thanks Varun!
This work perfectly, thanks for the help.
Regards,
Ted

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by