caffe增加新的层
来源:互联网 发布:adhoc算法 编辑:程序博客网 时间:2024/06/05 16:53
首先,对original的caffe配置成功,在此基础上进行添加新层
(一)具体步骤如下:
1. 修改{caffe_dir}/src/caffe/proto/caffe.proto 文件,在 V1LayerParameter的LayerType enum中添加新的layer的名称及ID(如:MYLAYER 38),并在V1LayerParameter中添加MyLayer的参数说明;在message LayerParameter中添加MyLayer的参数说明,同时更新 LayerParameter的available ID(如:optional MyLayerParameter my_layer_param = 146);最后添加新Layer的参数说明。
message MyLayerParameter {
optional uint32 para1 = 1; (1 is the ID of para1 in this layerparameter)
optional bool para2 = 2 [default = true];
optional FillerParameter para3 = 3;
optional float para4 = 4;
}
optional uint32 para1 = 1; (1 is the ID of para1 in this layerparameter)
optional bool para2 = 2 [default = true];
optional FillerParameter para3 = 3;
optional float para4 = 4;
}
如:我添加的center loss层
{caffe_dir}/src/caffe/proto/caffe.proto 文件
2. 在{caffe_dir}/src/caffe/util下的upgrade_proto.cpp的const char* UpgradeV1LayerType(const V1LayerParameter_LayerType type)函数中添加如下代码,方便已经训练好的模型进行转换。
case V1LayerParameter_MYLAYER :
return "MyLayer";
return "MyLayer";
例如:我的添加
3. 在{caffe_dir}/include/caffe/layers/ 文件夹中增加该layer的类的声明my_layer_layer.h文件。
4. 在{caffe_dir}/src/caffe/layers/目录下新建.cpp和.cu文件,进行类实现。
5. 在{caffe_dir}/src/caffe/test/中增加layer的测试代码,对所写的layer前传和反传进行测试,测试还包括速度。
(二)编译
make all -j8
Note:若报错,则根据相应的错误位置检查语法错误。
make test -j8
make runtest -j8
Note:若报错,则根据相应的错误位置检查逻辑错误。
0 0
- caffe增加新的层
- caffe添加新的层
- 在caffe中添加新的层
- 新了解的几个caffe层
- caffe 添加新的网络层
- 为caffe添加新的层
- 如何给caffe添加新的层
- caffe中添加新的网络层
- mxnet系列之 增加新的层
- Caffe扩展新层
- caffe 新层
- caffe添加新层教程
- caffe添加新层教程
- windows-caffe添加新层
- caffe添加新层windows
- caffe 添加一个新层
- Caffe-Windows添加新层
- caffe添加新层教程
- eclipse 汉化
- :target选择器 、三角形绘制、手风琴制作
- swift 可选项 "?" 和 "!"
- [内核源码][Makefile] Linux内核源码的Makefile
- Convert string to object (c#)
- caffe增加新的层
- UVA 247 Floyd算法
- windows的磁盘操作之十——获取磁盘型号
- tab切换优化
- 关于多属性查找问题的sphinx解决方案
- MAC平台下Xcode配置使用OpenCV的具体方法 (2016最新)
- ubuntu 16.04 安装谷歌拼音输入法
- 《UNIX网络编程卷1》读书笔记--第二章传输层
- 关于JSP基本语法的练习