Caffe 不同版本之间layer移植方法
2016-08-11 18:51
621 查看
本系列文章由 @yhl_leo 出品,转载请注明出处。
文章链接: http://blog.csdn.net/yhl_leo/article/details/52185521
(前两天这篇博客不小心被自己更改删除了,现在重新补上。)
Caffe版本一直在不停更新,新版本往往会包含一些新的layer,如果只想将该layer移植到自己工程的版本中,该怎么做呢?看到网上有关于添加新layer的教程:
Add a class declaration for your layer to the appropriate one of
Implement your layer in
(Optional) Implement the GPU versions
Add your layer to
Make your layer createable by adding it to
Write tests in
但是,这种方法并不一定对移植有用,以
因此,对于移植来说,直接搜索版本更新记录,是更加直接和高效的办法。
文章链接: http://blog.csdn.net/yhl_leo/article/details/52185521
(前两天这篇博客不小心被自己更改删除了,现在重新补上。)
Caffe版本一直在不停更新,新版本往往会包含一些新的layer,如果只想将该layer移植到自己工程的版本中,该怎么做呢?看到网上有关于添加新layer的教程:
Add a class declaration for your layer to the appropriate one of
common_layers.hpp,
data_layers.hpp,
loss_layers.hpp,
neuron_layers.hpp, or
vision_layers.hpp. Include an inline implementation of
typeand the
*Blobs()methods to specify blob number requirements. Omit the
*_gpudeclarations if you’ll only be implementing CPU code.
Implement your layer in
layers/your_layer.cpp.
SetUpfor initialization: reading parameters, allocating buffers, etc.
Forward_cpufor the function your layer computes
Backward_cpufor its gradient
(Optional) Implement the GPU versions
Forward_gpuand
Backward_gpuin
layers/your_layer.cu.
Add your layer to
proto/caffe.proto, updating the next available ID. Also declare parameters, if needed, in this file.
Make your layer createable by adding it to
layer_factory.cpp.
Write tests in
test/test_your_layer.cpp. Use
test/test_gradient_check_util.hppto check that your Forward and Backward implementations are in numerical agreement.
但是,这种方法并不一定对移植有用,以
CropLayer为例,按照上述的方法肯定是行不通的,编译的过程中会反复出现关于函数
DiagonalAffineMap的错误。查看版本更新记录:Crop layer for automatically aligning computations,可以发现,原来不只是添加两个文件那么简单的事情,按照版本更新的差异,逐个文件进行更改就可以使用。
因此,对于移植来说,直接搜索版本更新记录,是更加直接和高效的办法。
相关文章推荐
- Validform+layer实现漂亮的表单验证特效
- 小巧强大的jquery layer弹窗弹层插件
- 把jQuery的each(callback)方法移植到c#中
- IIS 服务器的备份和移植技巧
- 解析libcurl在android下的移植、编译与测试
- Objective-c代码如何移植为Swift代码 Objective-c代码转移到Swift过程介绍
- IOS CoreAnimation中layer动画闪烁的解决方法
- 将SSH移植到arm soc上
- ok6410开发板移植DirectFB手记
- Some Notes of Caffe Installation
- Some Notes of Python Interfaces Pycaffe (Caffe)
- TensorFlow人工智能引擎入门教程之十二 Caffe转换tensorflow并 跨平台调用
- TensorFlow人工智能引擎入门教程所有目录
- Supporting Python 3(支持python3)——语言区别和暂时解决方法
- Supporting Python 3(支持python3)——重组和重命名
- J2ME游戏移植到Android平台的方法
- J2me游戏如何快速移植到Android(1)
- J2me游戏如何快速移植到Android (2)
- android与j2me移植之clipRect
- 移植linux-2.6.30.4到S3C2440