windows caffe添加新层center loss layer
相关文件可见:https://github.com/ydwen/caffe-face主要包括4个步骤:(1)src\caffe\caffe.proto里添加消息机制:proto格式的ID号(要求ID号唯一,不与其他ID重合即可)及相应定义 在message LayerParameter{}中添加如下ID号: optional CenterLossPar...
相关文件可见:https://github.com/ydwen/caffe-face
主要包括4个步骤:
(1)src\caffe\caffe.proto里添加消息机制:proto格式的ID号(要求ID号唯一,不与其他ID重合即可)及相应定义
在message LayerParameter{}中添加如下ID号:
optional CenterLossParameter center_loss_param = 155;
再在文档最后加入:
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];
}
(2)include/caffe/layers/添加头文件center_loss_layers.hpp
(3)src/caffe/layers/添加CPU、GPU实现的相关文件center_loss_layers.cpp\center_loss_layers.cu
(4)重新编译Caffe。首先在windows/libcaffe/libcaffe.vcxproj和libcaffe.vcxproj.filters里
libcaffe.vcxproj相应处增加:
<ClCompile Include="..\..\src\caffe\layers\center_loss_layer.cpp" />
<ClInclude Include="..\..\include\caffe\layers\center_loss_layer.hpp" />
<CudaCompile Include="..\..\src\caffe\layers\center_loss_layer.cu" />
libcaffe.vcxproj相应处增加:
<ClCompile Include="..\..\src\caffe\layers\center_loss_layer.cpp">
<Filter>src\layers</Filter>
</ClCompile>
<ClInclude Include="..\..\include\caffe\layers\center_loss_layer.hpp">
<Filter>include\layers</Filter>
</ClInclude>
<CudaCompile Include="..\..\src\caffe\layers\center_loss_layer.cu">
<Filter>cu\layers</Filter>
</CudaCompile>
再重新编译。成功即可使用。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)