Transfer Learning

Antony Christopher
Analytics Vidhya
Published in
3 min readJun 14, 2021

Introduction

As humans growing and learning in day-to-day activities right from childhood. As humans acquire knowledge by learning one task. By using the same knowledge we tend to solve the related task. Say in real-time scenarios as

  • Know how to ride a motorbike ⮫ Learn how to ride a car
  • Know how to play classic piano ⮫ Learn how to play jazz piano
  • Know math and statistics ⮫ Learn machine learning

Transfer Learning in ML

Traditional ML used to create a separate model for each task/domain provided. There is no knowledge base for saving the model. Transfer Learning used to have a knowledge base to store the model trained /utilized for the specific task/domain. Further, we can use the same knowledge to train the new model.

To make a better understanding consider the example to implement the two possible scenarios as

  • To identify objects in images within a restricted domain of a restaurant say as T1
  • To detect objects from images in a park or a café as T2.

Let’s start doing the task using traditional ML, we need to create the two models namely Model A & Model B. Where Model A used to implement task T1 and Model B used to implement task T2. In the end, by using the respective model of A & B, can detect the object based on the business needs.

Okay!!. If we go for the Transfer Learning approach the below one will be accomplished. If we start to implement task T1 create the new model using deep learning as (TFOD, CV2…etc) detect the objects in the restaurant and finally save the model to the knowledge base. To implement task T2 we don’t need to create another new model rather take the saved model from the knowledge base. From the saved model, we can use it for task T2 as well. From both ask having similarities of object detection, so we can opt for transfer learning as optimum implementation for this. If the task having lane detection/traffic light detection means, we can’t use the same model to train the data.

Let’s implement the Binary classification using Python. Here we use the Keras mnist dataset. Train the model with optimized parameters and finally save the model. Use the saved model for binary classification. Let’s see how can achieve in transfer learning methodology.

Hope this article gives you a better idea of Transfer Learning.

Thanks for reading the article :)

See you soon at my next one !!!

--

--

Antony Christopher
Analytics Vidhya

Data Science and Machine Learning enthusiast | Software Architect | Full stack developer