I am trying to build detectron with my custom network backbone.
1.
I am using affine channel in detectron instead of batch norm layer and i want to freeze this layer.
In ResNet.py file they use stopgradient but i think it freeze all previous layers.
Is that correct to use stopgradient to freeze a certain one layer?
That's my problem, too.
I have tried to replace ResNet backbone with my custom backbone networks that was pretrained in caffe and had batchnorm+scale layer.
So ,firstly, I converted .caffemodel to .pkl file.
Second, define my backbone networks as like ResNet.py.
When I define my backbone network that have bachnorm layer, as like ResNet.py, I used AffineChannel layer instead of batchnorm.
My questions are here,
In the ResNet.py, model.StopGradient(s, s) ,I guess, freezes all parameters not only batchnorm parameters(the scale and bias in AffineChannel).
There is a method TrainableParams() in DetectionModelHelper class in detectron/modeling/detector.py which returns all trainable params. It depends on self.do_not_update_params list, so you can actually somehow append your param names to it manually and that would effectively freeze the weight. That might help.
@zeenolife thanks!
Hi,I wonder to know the effect of the 'inplace‘ in AffineChannel,What's the impact of setting it to True or false? @lsrock1 @youngwanLEE
Most helpful comment
There is a method
TrainableParams()inDetectionModelHelperclass indetectron/modeling/detector.pywhich returns all trainable params. It depends onself.do_not_update_paramslist, so you can actually somehow append your param names to it manually and that would effectively freeze the weight. That might help.