本系列文章由 @yhl_leo 出品,转载请注明出处。

文章链接: http://blog.csdn.net/yhl_leo/article/details/52185521


(前两天这篇博客不小心被自己更改删除了,现在重新补上。)

Caffe版本一直在不停更新,新版本往往会包含一些新的layer,如果只想将该layer移植到自己工程的版本中,该怎么做呢?看到网上有关于添加新layer的教程:

  1. 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 type and the *Blobs() methods to specify blob number requirements. Omit the *_gpu declarations if you’ll only be implementing CPU code.
  2. Implement your layer in layers/your_layer.cpp.
    • SetUp for initialization: reading parameters, allocating buffers, etc.
    • Forward_cpu for the function your layer computes
    • Backward_cpu for its gradient
  3. (Optional) Implement the GPU versions Forward_gpu and Backward_gpu in layers/your_layer.cu.
  4. Add your layer to proto/caffe.proto, updating the next available ID. Also declare parameters, if needed, in this file.
  5. Make your layer createable by adding it to layer_factory.cpp.
  6. Write tests in test/test_your_layer.cpp. Use test/test_gradient_check_util.hpp to check that your Forward and Backward implementations are in numerical agreement.

但是,这种方法并不一定对移植有用,以CropLayer为例,按照上述的方法肯定是行不通的,编译的过程中会反复出现关于函数DiagonalAffineMap的错误。查看版本更新记录:Crop layer for automatically aligning computations,可以发现,原来不只是添加两个文件那么简单的事情,按照版本更新的差异,逐个文件进行更改就可以使用。

因此,对于移植来说,直接搜索版本更新记录,是更加直接和高效的办法

最新文章

  1. SQL 通过syscolumns.xtype动态查找指定数据类型字段所包含的数据
  2. Analyzing The Papers Behind Facebook's Computer Vision Approach
  3. Swift协议(Protocol)
  4. PC-红警联机问题与下载
  5. jsp页面中定时的方法
  6. 网站遭遇DDOS简易处理
  7. 团队作业4——第一次项目冲刺(Alpha版本) Day2
  8. iOS原生和H5的相互调用
  9. 好程序员分享居中一个float元素
  10. Linux更新源汇总-18.9.7更新
  11. Akka-CQRS(0)- 基于akka-cluster的读写分离框架,构建gRPC移动应用后端架构
  12. Scala:First Steps in Scala
  13. 架构师成长之路1.1-系统监控工具htop
  14. 后台管理UI+功能
  15. transform动画效果
  16. go语言之进阶篇成员操作
  17. $.cookie is not a function;原因及解决办法
  18. 基于html5鼠标悬停图片动画展示效果
  19. linux下node-webkit安装vlc插件
  20. Openstack(九)部署nova服务(控制节点)

热门文章

  1. python搭建ftp服务器
  2. Json字符串转excel表格文件
  3. Android Studio中通过CMake使用NDK并编译自定义库和添加预编译库
  4. matlab载入图像,旋转,裁剪 保存
  5. 【读书笔记】构建之法(CH4~CH6)
  6. window服务的使用
  7. QT如何设置应用程序的图标
  8. POJ 2449 Remmarguts' Date
  9. Vue相关问题
  10. ubuntu 18.* 重启网卡