top of page
Mayuresh Madiwale

A brief about Transfer Learning process



Deep learning is a sub-branch of the ML. It works on base of a Neuron which is inspired by the structure of human brain. Deep learning techniques used in recent years continue to show impressive performance in almost all fields comprising image processing.


The complete process is demonstrated using a real life example in my previous blog Forest Fire Detection Using CNN Part 4


Traditional ML is although gets the work done properly but has an disadvantage to be slower if the data is too big. Here the TL (Transfer Learning) comes handy.

In simple words, TL reduces the learning time significantly by providing the Weights and Biases for the target class through pre-defined models. These models are trained over a large dataset such as ImageNet and stores the W's and B's to be extracted whenever needed. The process is simple, head over to any website that provides pre-trained models such as Kaggle, TensorFlow Hub or Keras Applications and download the model. then when the model is fitting, the W's and B's are then used for the given class from the main dataset, provided the image class is present in it.


TL is a research problem in machine learning (ML) that focuses on storing knowledge gained while solving one problem and applying it to a different but related problem. For example, the knowledge gained while learning to recognize Camp fire could apply when trying to recognize fire in different scenarios where fire is involved such as Wildfire. This area of research bears some relation to the long history of psychological literature on the transfer of learning, although formal ties between the two fields are limited. From a practical standpoint, reusing or transferring information from previously learned tasks for the learning of new tasks has the potential to significantly improve the sample efficiency of a reinforcement learning agent.


The Process

The process can be explained in brief as follows

  1. Selecting the Head Model (Pre-trained)

  2. Attaching the Head to the Body

  3. Model Evaluation


Head Model


This is the main model which will give us our W's and B's. Pre-trained models are trained on humongous datasets such as ImageNet-21k which is a dataset that contains images for 21,000 classes of different things such as cars, animals, etc.

Kaggle has some pre-trained models which you can see Here. TFHub has many models that can be seen Here. Keras Application has many models Here. Hugging Face has a great collection of them too, find it Here.

The best part is all the models are Free and made by experts from top companies in the field such as Google, etc.


Attaching the Head to the Body


Here by the Body I mean the last layer of the model which will give the output specifically to our use case. I you see the previous blog on Forest Fire, the last layer is made binary with Sigmoid so as to give a required output as "Fire" or "NoFire".

This step is the most important as if the Trainable option in the head model is left ON, then the model is most likely prone to give out wrong outputs. The number of neurons are to be set according to the number of outputs expected.


Model Evaluation


Last but not the least, the evaluation. Here we will see the performance of the model. In my last attempt of TL in Forest Fire Detection, I've seen that the accuracy and validation accuracy gets nearly to 100%, but somehow, the image prediction is completely wrong. This might be the case because the model trained on the specific dataset might not contain the desired class. So I Iterated the same process again on a different model and then finally on the third attempt I got the desired output.


Final Words

  • TL is like a boon to the Industry.

  • It has reduced the required computing power significantly.

  • It has saved the most important factor "Time"

  • Most of the models are free to use and developed by top companies.

  • It can be tedious to find a perfect model as specific image classes can be missing even in big datasets and to get such a dataset and then a model trained on it is hard to find.

  • Overall the process is great and quicker than traditional DL.

182 views0 comments

Recent Posts

See All

コメント


bottom of page