(1)书写 include/caffe/layers/xxx_layer.hpp ;
(2) 书写src/caffe/layers/xxx_layer.cpp ;
(3) (optional)若需要在GPU上实现,书写src/caffe/layers/xxx_layer.cu ;
(4) 修改src/caffe/layer_factory.cpp,增加这个函数
// Get pooling layer according to engine.
GetxxxLayer(){if else…}
(5) 修改src/caffe/proto/caffe.proto,为新写的层添加参数和消息函数
为新写的层添加参数 :
optional name_param = 143;
为新写的层添加消息函数:
message xxxParameter {
optional float aaa = 1 [default = 1];
}
(6)最后重新编译caffe
make all
make test
make runtest