How transfer learning happening in tensorfow object detection API ? Can we keep feature extractors weight unchanged while only changing the predictor weights .
There are few types of transfer learning . When using TF Object Detection API do we fine tune weights of the feature extractor when using already trained models on COCO Data Set .
Because sometimes we can just keep the weight set of feature extractor fix while training only the predictor layers .
This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!
@skye It would be great if the Object-Detection API maintainers give a description about it .
Fair enough, I'll reopen this as a docs request.
@jch1 @tombstone @derekjchow @jesu9 @dreamdragon FYI
This can be accomplished by using the freeze_variables field in the train proto.
That being said, I'm hesitant about adding this to the docs. From our experience freezing the base feature extractors doesn't train faster nor does it give a better end accuracy. I would not recommend users use this field.
Hi @derekjchow is it possible to explain further what kind of input could be used with freeze_variables?
@derekjchow I would also be interested to see some examples of how to use freeze_variables field.
By the way, the link is broken, here is a new one: https://github.com/tensorflow/models/blob/538f89c4121803645fe72f41ebfd7069c706d954/research/object_detection/protos/train.proto#L51
While we are waiting for a developer answer, I can share what I figure out. You can freeze variables by adding freeze_variables:
@uziela thanks for sharing that. Also I have another question, how are weights initialized when no checkpoints are provided?
@uziela I wanted to train the SSD Inception from scratch. I don't want to use the transfer learning at all. I want to train the network from the scratch. Is there any suggestion I should look into? If I have understood correctly freezing_variables means we will not update the weights of those layers? correct me if I am wrong.
@viralbthakar you understood correctly regarding freezing_variables. If you don't want to use any transfer learning, just delete fine_tune_checkpoint and from_detection_checkpoint fields from the config file. However, note that I am not a tensorflow developer, this is just what I understood from the user guide: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/configuring_jobs.md
@derekjchow ,since "From our experience freezing the base feature extractors doesn't train faster nor does it give a better end accuracy". what does this means? from my learned, fine-tuned seems has been a must way for transfer learning of different task of same field(detect / classification .....). which could get at least near precision of original models with FEWER samples.this seems is already a common sense in DL. so your conclusion is a little bit confused me.
1:if your conclusion is right , does it means we should only can train model from scratch with huge data? (both meta arch(feature exactor) and detect arch(ssd / faster rcnn...))
2:if I want use freeze_variables for more experimentation of fine-turned, any samples can provided??
anyone shared about fine-tuned with TF experience is very appreciated !
thanks in advance!!
@beyondli
- Freezing the lower layers of the net makes it possible to only perform transfer learning. As @derekjchow said, freezing them does not output satisfactory results thus finetuning the model to your dataset is the better method as it is in this type of retraining, we keep all the layers editable and that is the default settings for the config file.
Hello @uziela
Following your suggestion, "You can freeze variables by adding freeze_variables: option under "train_config" in pipeline config file. For example, freeze_variables: ".FeatureExtractor." will freeze the feature extractor. You can find out all variable names that can be frozen by adding print("var.op.name: " + var.op.name ) statement into the for loop after line 46 in object_detection/utils/variables_helper.py",
I got the following output from SSD InceptionV2 coco model:
var.op.name: FeatureExtractor/InceptionV2/Conv2d_1a_7x7/depthwise_weights var.op.name: FeatureExtractor/InceptionV2/Conv2d_1a_7x7/pointwise_weights var.op.name: FeatureExtractor/InceptionV2/Conv2d_1a_7x7/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Conv2d_1a_7x7/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Conv2d_2b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Conv2d_2b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Conv2d_2b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Conv2d_2c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Conv2d_2c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Conv2d_2c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3b/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_3c/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_0/Conv2d_1a_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_0/Conv2d_1a_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_0/Conv2d_1a_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_1a_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_1a_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4a/Branch_1/Conv2d_1a_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4b/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4c/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4d/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_4e/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_0/Conv2d_1a_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_0/Conv2d_1a_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_0/Conv2d_1a_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_1a_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_1a_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5a/Branch_1/Conv2d_1a_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5b/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_0/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_0/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_0/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_1/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_1/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_1/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_1/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_1/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_1/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0a_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0a_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0b_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0b_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0b_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0c_3x3/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0c_3x3/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_2/Conv2d_0c_3x3/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_3/Conv2d_0b_1x1/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_3/Conv2d_0b_1x1/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c/Branch_3/Conv2d_0b_1x1/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_2_1x1_256/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_2_1x1_256/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_2_1x1_256/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_2_3x3_s2_512/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_2_3x3_s2_512/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_2_3x3_s2_512/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_3_1x1_128/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_3_1x1_128/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_3_1x1_128/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_3_3x3_s2_256/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_3_3x3_s2_256/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_3_3x3_s2_256/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_4_1x1_128/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_4_1x1_128/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_4_1x1_128/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_4_3x3_s2_256/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_4_3x3_s2_256/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_4_3x3_s2_256/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_5_1x1_64/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_5_1x1_64/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_1_Conv2d_5_1x1_64/BatchNorm/beta var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_5_3x3_s2_128/weights var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_5_3x3_s2_128/BatchNorm/gamma var.op.name: FeatureExtractor/InceptionV2/Mixed_5c_2_Conv2d_5_3x3_s2_128/BatchNorm/beta var.op.name: BoxPredictor_0/BoxEncodingPredictor/weights var.op.name: BoxPredictor_0/BoxEncodingPredictor/biases var.op.name: BoxPredictor_0/ClassPredictor/weights var.op.name: BoxPredictor_0/ClassPredictor/biases var.op.name: BoxPredictor_1/BoxEncodingPredictor/weights var.op.name: BoxPredictor_1/BoxEncodingPredictor/biases var.op.name: BoxPredictor_1/ClassPredictor/weights var.op.name: BoxPredictor_1/ClassPredictor/biases var.op.name: BoxPredictor_2/BoxEncodingPredictor/weights var.op.name: BoxPredictor_2/BoxEncodingPredictor/biases var.op.name: BoxPredictor_2/ClassPredictor/weights var.op.name: BoxPredictor_2/ClassPredictor/biases var.op.name: BoxPredictor_3/BoxEncodingPredictor/weights var.op.name: BoxPredictor_3/BoxEncodingPredictor/biases var.op.name: BoxPredictor_3/ClassPredictor/weights var.op.name: BoxPredictor_3/ClassPredictor/biases var.op.name: BoxPredictor_4/BoxEncodingPredictor/weights var.op.name: BoxPredictor_4/BoxEncodingPredictor/biases var.op.name: BoxPredictor_4/ClassPredictor/weights var.op.name: BoxPredictor_4/ClassPredictor/biases var.op.name: BoxPredictor_5/BoxEncodingPredictor/weights var.op.name: BoxPredictor_5/BoxEncodingPredictor/biases var.op.name: BoxPredictor_5/ClassPredictor/weights var.op.name: BoxPredictor_5/ClassPredictor/biases
I thought BoxPredictor_* is the predictors, not the extractors.
Do I miss anything?
Here is where I add freeze_variables in the config file:
train_config: { batch_size: 2 optimizer { rms_prop_optimizer: { learning_rate: { exponential_decay_learning_rate { initial_learning_rate: 0.004 decay_steps: 800720 decay_factor: 0.95 } } momentum_optimizer_value: 0.9 decay: 0.9 epsilon: 1.0 } } fine_tune_checkpoint: "/media/garmin/Data/TensorFlowModels/research/object_detection/pre-trained-models/SSD_InceptionV2/model.ckpt" from_detection_checkpoint: true num_steps: 500000 data_augmentation_options { random_horizontal_flip { } } data_augmentation_options { ssd_random_crop { } } freeze_variables: ".FeatureExtractor." }
Thank you for precious time on my questions.
Hi,
You are right, BoxPredictor is the predictor, not the feature extractor. That's why you need to write a regex that only captures the feature extractor variables. You did everything correctly, but you are missing the star (*) symbols in the regex. So change your "freeze variables" line in the config file by:
freeze_variables: ".*FeatureExtractor.*"
Hello @uziela ,
Thank you so much for the quick response.
I do have the * in the config but the in my last post I forget to modify the regex in this post.
So in my config, the regex is
freeze_variables: ".*FeatureExtractor.*"
After digging into the code,
to show which layers are frozen,
you need add print("var.op.name" + var.op.name)
after if re.match(pattern, var.op.name): # line 53.
The line you suggest prints out all variables.
Another question I have is how to initialize predictor layers' weight randomly, instead of loading from the pre-trained model.
In summary,
I want to
-
load feature extractor layers' weight but freeze them from training.
-
initialize predictor layers weight randomly but train them.
I am having the similar issue as
https://github.com/tensorflow/models/issues/3384
and wonder my transfer learning can improve it.
Please let me know if any question or suggestion.
Thank you for precious time on my questions.
I borrowed everything from TF/Model_Zoo (the config files and the model files as is), and started the training (which is what I have been doing as explained above), what am I training then? If there is no detail in the config files like: } freeze_variables: ".FeatureExtractor." } Does that mean everything is getting retrained? When I look into the tensor-board, it looks like the weights are not changing but the biases are changing. Does that mean I am not doing transfer-learning?
What if I want to retrain only the last 2 layer? Is that going to be for both feature_extractor and CNN? Do I need to list all the layers (that huge long list @willSapgreen posted), is there a way to indicate that in a brief'er way?
Also, what are the box_predictors are for? Are they the regressor part of the object_detection?
I am new at object detection. I have been using the medium repos for starters, I started tuning the learning_rate etc... but some of these terms are a bit not clearly indicated?
Thank you very much in advance, and even partial answers are appreciated as I do not have anyone to ask these questions to. 😃 😁
Hello @uziela ,
Thank you so much for the quick response.
I do have the * in the config but the in my last post I forget to modify the regex in this post.
So in my config, the regex is
freeze_variables: ".FeatureExtractor."
After digging into the code,
to show which layers are frozen,
you need add print("var.op.name" + var.op.name)
after if re.match(pattern, var.op.name): # line 53.
The line you suggest prints out all variables.
Another question I have is how to initialize predictor layers' weight randomly, instead of loading from the pre-trained model.
In summary,
I want to
- load feature extractor layers' weight but freeze them from training.
- initialize predictor layers weight randomly but train them.
I am having the similar issue as
#3384
and wonder my transfer learning can improve it.
Please let me know if any question or suggestion.
Thank you for precious time on my questions.
excuse me if i want use the initial weights of vgg or zfffor the feature extractor and for object detection is false how ican this
Hi all,
I am trying to detect 90+2(custom) classes using object detection api. I know we can detect 90 classes by default and we can detect 2 custom classes passing new data and Finetune model checkpoint. I want to detect 92 classes at once. Will this solution freeze_variables: ".FeatureExtractor." work for my problem. I am new to object detection api and computer vision. Please help!
@willSapgreen I think you can change your "load_all_detection_checkpoint_vars" line in the config file by: load_all_detection_checkpoint_vars: false
In this way, the model will only load the feature extractor weight.
i confirm
Le ven. 2 nov. 2018 à 09:35, 李明浩 [email protected] a écrit :
@willSapgreen https://github.com/willSapgreen I think you can change your "load_all_detection_checkpoint_vars" line in the config file by: load_all_detection_checkpoint_vars: false
In this way, the model will only load the feature extractor weight.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/2203#issuecomment-435307514, or mute the thread https://github.com/notifications/unsubscribe-auth/AneKqBr9_SLOMehY2JPGEAKWWLdeFhWNks5urAPSgaJpZM4O1xrO .