Search code examples
deep-learningconv-neural-networktransfer-learning

Keras Applications (Transfer Learning)


I am a student and currently studying deep learning by myself. Here I would like to ask for clarification regarding the transfer learning.

For example MobileNetv2 (https://keras.io/api/applications/mobilenet/#mobilenetv2-function), if the weights parameter is set to None, then I am not doing transfer learning as the weights are random initialized. If I would like to do transfer learning, then I should set the weights parameter to imagenet. Is this concept correct?

Clarification and explanation regarding deep learning


Solution

  • Yes, when you initialize the weights with random values, you are just using the architecture and training the model from scratch. The goal of transfer learning is to use the previously gained knowledge by another trained model to get better results or to use less computational resources.

    There are different ways to use transfer learning:

    • You can freeze the learned weights of the base model and replace the last layer of the model base on your problem and just train the last layer
    • You can start with the learned weights and fine-tune them (let them change in the learning process). Many people do that because sometimes it makes the training faster and gives better results because the weights already contain so much information.
    • You can use the first layers to extract basic features like colors, edges, circles... and add your desired layers after them. In this way, you can use your resources to learn high-level features.

    There are more cases, but I hope it could give you an idea.