Skip to content

Transfer learning and fine tuning of hidden layers and the final layer #10602

@santhoshnumberone

Description

@santhoshnumberone

Description

I want to re-train a pre trained Tensorflow Object Detection API using transfer learning and fine tune it further to improve the network for detection for the custom data that I currently have.

1. The entire URL of the file you are using

For inferencing: TensorFlow Hub Object Detection Colab to check which model has already learnt features which help it at least detect(draw bounding box) around my custom data.

For training:

I am looking into Tensorflow 2 Object Detection API tutorial

training-custom-object-detector to create custom dataset

configure-the-training-pipeline to change the scheduling the learning rate inside the optimiser and other usual changes

2. Describe the feature you request

I was able get a low confidence object detection(bounding box) for the particular custom object I wanted to re-train the network on CenterNet HourGlass104 512x512 is the model.

The custom object, I want to detect is being detected as a cell phone most of the times, bottle few times and book one or more times.

Looking into mscoco_label_map.pbtxt used for CenterNet HourGlass104 512x512 inference

.....
.....
item {
  name: "/m/04dr76w"
  id: 44
  display_name: "bottle"
}
.....
.....
item {
  name: "/m/050k8"
  id: 77
  display_name: "cell phone"
}
.....
.....
item {
  name: "/m/0bt_c3"
  id: 84
  display_name: "book"
}
.....
.....

Looking at the diagram below

The-architecture-of-our-transfer-learning-model

I have few questions with the current task, I have at hand

  1. How do I freeze the features extraction layer? Should it be done inside pipeline.config file if YES then how?
  2. Since the predictions on item with id 77 is being detected already with low confidence in most cases, I feel freezing the feature layer and training the final dense layer with the weights used predict the item id 77 would be a good approach. My question how to a load weight of prediction on item id 77
    in the final dense layer?

Combining both questions

How to I freeze the feature extraction layers, while loading only weights of item id 77 in the final dense layer unfreezing them for training? What are all the changes I would have to make in which particular files?

If it can't be done using pipeline.config how do I do it using keras as everything changes from loading data for training to test data onto the model. Since I'm new to this any examples of doing this would be really be helpful

3. Are you willing to contribute it? (Yes or No)

I am new to this, if I could have helped I would have written a medium blog on how to do it. No I doubt if I can contribute.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions