1. 程式人生 > >如何向caffe中添加層

如何向caffe中添加層

ssa nbsp caff -1 類型信息 single 模式 caf brush

修改caffe\src\caffe\proto\caffe.proto

在最後添加centerloss層的參數信息

message CenterLossParameter {
optional uint32 num_output = 1; // The number of outputs for the layer
optional FillerParameter center_filler = 2; // The filler for the centers
// The first axis to be lumped into a single inner product computation;
// all preceding axes are retained in the output.
// May be negative to index from the end (e.g., -1 for the last axis).
optional int32 axis = 3 [default = 1];
}

 

添加層類型信息,註意不能與其他層的數字相同。

 

optional CenterLossParameter center_loss_param = 148;

將cpu和gpu兩個模式下運行的文件添加到src\caffe\layers\

如何編寫層,請查看官方文檔或者谷歌

3.添加層的頭文件

向\include\caffe\layers\中添加頭文件

如何向caffe中添加層