Search code examples
deep-learningcaffebatch-normalization

how to add customize bn layer to caffe


I download a deeplabV2 project from GitHub and find it does not have "BN" layer.
I want to add it to caffe code but meet this error:

src/caffe/layers/batch_norm_layer.cpp:250:31: 
error: macro "REGISTER_LAYER_CLASS" requires 2 arguments, but only 1 given REGISTER_LAYER_CLASS(BatchNorm);

How to solve it please?


Solution

  • It looks like you're using an old Caffe version that takes 2 parameters for the REGISTER_LAYER_CLASS macro, but BN layer is suitable to a newer Caffe version where the macro was changes to take only one parameter (which is the layer type).
    You can either check in other layers what is the other parameter for REGISTER_LAYER_CLASS and add it accordingly to your BN layer, or take an updated version of Caffe and merge deeplab layers into it.
    (Alternatively, this appears to be a deeplab2 Caffe repo, up to date, with BN support: https://github.com/xmyqsh/deeplab-v2)