How to retrain a deep neural network with another dataset which is already trained using a particular dataset?

8 views (last 30 days)
I have designed a deep neural network and trained it using dataset-1. I have saved the network as my best model. Now I want to retrain this network with another dataset-2. In the following code "Net, trailingAvg, trailingAvgSq" used inside "adamupdate" is the network, average gradient and squared average gradient respectively. These three were already saved during training process using dataset-1. Is this is right way to retrain the network? Do I need to keep the dataset-1 with with the new dataset-2 to retrain (due to the chance of forgetting the old weight)? Provided the dataset is 1-D.
[Net,trailingAvg,trailingAvgSq] = adamupdate(Net,gradients,trailingAvg,trailingAvgSq,iteration,learnRate,decay);

Answers (1)

Ganesh
Ganesh on 5 Dec 2023
The implementation you are trying to achieve is the same as a "Transfer Learning system". The right way to do this would be load the weights and retrain the model using the new dataset. In order to ensure that the original model is not majorly affected, kindly choose an appropriate "Learning Rate" (generally, a lower learning rate to the prior training)
"Transfer Learning" is achievable with the "Deep Learning Toolbox", kindly refer to the link below:

Community Treasure Hunt

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

Start Hunting!