python models/object_detection/train.py --train_dir=Test --pipeline_config_path=faster_rcnn_resnet101_Button_Cell.config
When trying to fine-tune from a non-detection checkpoint (from_detection_checkpoint: false in config) the model will not properly load the variables. Prints out a large amount of warnings in this form...
WARNING:root:Variable [resnet_v1_101/conv1/BatchNorm/moving_mean] not available in checkpoint
WARNING:root:Variable [resnet_v1_101/conv1/BatchNorm/moving_variance] not available in checkpoint
WARNING:root:Variable [resnet_v1_101/conv1/weights] not available in checkpoint
Followed by:
ValueError: No variables to save
If I turn from_detection_checkpoint to true everything loads and runs properly. I am using an unedited version of the api and a slightly modified version of the cocosample config. Just filled in where the checkpoints are. I have attempted this using the checkpoints provided on the model detection zoo. Specifically the rfcn_resnet101_coco, and faster_rcnn_resnet101_coco models.
I apologize if the formatting is improper I am rather new to github.
Please let me know if any other information is required.
Here is the config file I am using. All I am doing to create the issue is turning "from_detection_checkpoint" parameter from true to false.
@AdamSanderson93 could you describe what checkpoint you're trying to finetune from? Is it a tf.slim classification checkpoint?
@derekjchow I tested this with two separate checkpoints both provided in the model detection zoo from the object detection API. The link to which I have attached below.
https://github.com/tensorflow/models/blob/master/object_detection/g3doc/detection_model_zoo.md
I tried to load both the rfcn_resnet101_coco, and faster_rcnn_resnet101_coco into a model with the config file provided previously. I got the same errors from both checkpoints when "from_detection_checkpoint" was set to false.
from_detection_checkpoint should be set to true for those check points (they are detection checkpoints). faster_rcnn_resnet101_coco should be the checkpoint to use.
Is there any way to load in just the feature extractors from the detection checkpoints or do I have to get them from a different repository?
Setting the finetune_checkpoint variable will only load the feature extractors.
So if I'm understanding you correctly. If I load a pretrained network from the model detection zoo and set "from_detection_checkpoint" to true it will only load the feature extractor layers (In my case resnet 101) and not the RPN, or second stage box predictor layers.
However if I set "from_detection_checkpoint" to false I need to use a checkpoint from the slim pretrained networks found here: https://github.com/tensorflow/models/tree/master/slim#Pretrained
@AdamSanderson93 @jch1 , It is not possible to use the released detection checkpoint from model zoo and set from_detection_chekpoint to false. I tried this and it throws errors for BatchNorm parameters (for Faster RCN and ResNet101).
Wondering if we wanted to start the training from a classification checkpoint, then should we load from detection checkpoint and re-initialize the RPN and rest of the network to initial values? Is there a classification checkpoint available we can use directly?
Figured this out: download classification models from https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models, then set from_detection_checkpoint = false, and point to the classification model, you should be able to train (for details look at the the documentation is g3doc folder).
Hi, everyone, I have already fine tune a classification model from slim, and I want to combine this fine tuned model with the RPN network from object detection model zoo(RPN will not be fine tuned, I want to just use the parameter of the object detection model), is there some ways to achieve this?
What type of classification model do you have? If it is one of the ones
from the model zoo, then you should be able to add RPN to it.
On Nov 20, 2017 6:49 PM, "FightForCS" notifications@github.com wrote:
Hi, everyone, I have already fine tune a classification model from slim,
and I want to combine this fine tuned model with the RPN network from
object detection model zoo(RPN will not be fine tuned, I want to just use
the parameter of the object detection model), is there some ways to achieve
this?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/2025#issuecomment-345900006,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AdotlY1Olxt5nG_MGIGnzf0Ow2eCMzDjks5s4jo6gaJpZM4Ohg7E
.
@vikramg1 resnet 50, can you give me some instruction on how to add RPN,
I have googled a lot, but still did not get useful information, Thanks
So, the thing is that the Resnet-50 that you have will probably be different than the implementations released by Google. They have BN, and also the structure is slightly different w.r.t. the downsampling location.
Anyways, try it by setting the from_detection_checkpoint set to false in the config file for object detection API. Then set the model location to your trained model.
The one thing that you can try is use the resnet model released by google first [using the above settings]. that worked for me. Then you can try your own model. Hope this helps.
@vikramg1 now I want to load the resnet50 detection model (Say model A) from tensorflow detection model zoo, then I will load my already fine tuned slim resnet50 model(Say model B), and hopefully, the feature extract part of model B will overwrite the feature extract part of model A, which is what I want that combines RPN parameter from model A and classification head from model B.
now, my encountered problem is: I want to load all parameter from model B, including the fully connected part, setting from_detection_checkpoint=False is not enough (it only load the conv layer, I guess), is there a way to load the fc layer parameter?
Thanks for you previous reply.
I solved this problem just commenting the line fine_tune_checkpoint
.
Let the line from_detection_checkpoint: false
in the configuration file but comment or erase the line fine_tune_checkpoint: "path/model.ckpt"
.
This way the training process will start from zero.
Let the line from_detection_checkpoint: false in the configuration file but comment or erase the line fine_tune_checkpoint: "path/model.ckpt".
It helps for me.
Thanks! @randolfo75
Hello @randolfo75 ,
when setting from_detection_checkpoint: false
,
should we use the model from TensorFlow-Slim image classification model library instead?
This is my interpretation about the following sentence
from_detection_checkpoint is a boolean value. If false, it assumes the checkpoint was from an object classification checkpoint.
from configuring_jobs.md configuring_jobs.md,
Please let me know if any misunderstanding.
Thank you.
Hi @willSapgreen,
I agree with your interpretation. Earlier I didn't get this, but your comment was very helpful to me better understand this configuration. Nevertheless, my goal was to start from scratch without any previous training and I was always having an error setting from_detection_checkpoint to false.
Thanks for your comment, now I can deduce the error was because I should change the checkpoint to a TensorFlow-Slim image classification model library and everything would make more sense.
I didn't test your statement but make all sense to me.
Funny is, even I got my goal, my interpretation was wrong.
Thank you.
Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
I solved this problem just commenting the line
fine_tune_checkpoint
.
Let the linefrom_detection_checkpoint: false
in the configuration file but comment or erase the linefine_tune_checkpoint: "path/model.ckpt"
.
This way the training process will start from zero.
VOCÊ É UM DEUS, MONSTRO UM INSANO !!! MUITO OBRIGADO
Most helpful comment
I solved this problem just commenting the line
fine_tune_checkpoint
.Let the line
from_detection_checkpoint: false
in the configuration file but comment or erase the linefine_tune_checkpoint: "path/model.ckpt"
.This way the training process will start from zero.