When doing transfer learning, which initial layers do we need to freeze, and how should I change the last layer for my task?
After a lot of browsing online for answers to these questions, this is what I came up with.


What are the initial layers in this case? How exactly can I freeze them?


The initial few layers are said to extract the most general features of any kind of image, like edges or corners of objects. So, I guess it actually would depend on the kind of backbone architecture you are selecting.
How to freeze the layers depends on the framework we use.
(I have selected PyTorch as the framework. I found this tutorial Some important Pytorch tasks - A concise summary from a vision researcher, which seems to be useful.)


What are the changes I need to make while training the NN to classify one or more new classes?


I just need to change just the number of neurons (or units) in the final layer to the number of classes/objects your new dataset contains.