chengyangfu / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
169 stars 47 forks source link

How can I finetune the entire network for the model with 513x513? #3

Closed Kevin35Day closed 7 years ago

Kevin35Day commented 7 years ago

Thank you for your work! I am trying to train my own data on DSSD,I noticed that you marked '# Finetuning the entire network only works for the model with 513x513 inputs not 321x321.' Does that mean I cant not set the input as 321*321 in DSSD training?Otherwise I would fail to finetune the entire network? If so,I can not find the third python file to finetune the entire network in your 513x513 example. How can I change 'ssd_pascal_resnet_deconv_ft_321.py' into 513 version ? Please help me if anyone has solved this problem. Thank you!!!

chengyangfu commented 7 years ago

Hi @Kevin35Day, I train the DSSD model in the following order. First is to train a SSD model first. Then use this SSD as the pre-trained model and add extra DSSD layers. When training DSSD model, all the SSD layers are frozen. The last step is to finetune entire DSSD model together. But this finetune does not provide consistent results. According to my experience, it seems only working for the model with 513x513 inputs. For your second question, you can check the difference between "ssd_pascal_resnet_deconv_321.py" and "ssd_pascal_resnet_deconv_ft_321.py" first. Then modify the ssd_pascal_resnet_deconv_513.py in the same way. The following lines are the code I thought you may need to change.

Change the pretrained model: https://github.com/chengyangfu/caffe/blob/dssd/examples/ssd/ssd_coco_resnet_deconv_513.py#L310

Don't freeze the model: https://github.com/chengyangfu/caffe/blob/dssd/examples/ssd/ssd_coco_resnet_deconv_513.py#L510-L516 https://github.com/chengyangfu/caffe/blob/dssd/examples/ssd/ssd_coco_resnet_deconv_513.py#L559-L565 ResNet101Body(net, from_layer='data', use_pool5=False, use_dilation_conv5=True, bn_param) AddExtraLayers(net, use_batchnorm=True, bn_param) I am not sure about freezing the BN layers or not. You can try it.