最近看到prototxt里面有silence这个层,好奇是干什么用的,而且看源码也出奇的简单:

#include <vector>

#include "caffe/layers/silence_layer.hpp"
#include "caffe/util/math_functions.hpp" namespace caffe { template <typename Dtype>
void SilenceLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {
for (int i = ; i < bottom.size(); ++i) {
if (propagate_down[i]) {
caffe_set(bottom[i]->count(), Dtype(),
bottom[i]->mutable_cpu_diff());
}
}
} #ifdef CPU_ONLY
STUB_GPU(SilenceLayer);
#endif INSTANTIATE_CLASS(SilenceLayer);
REGISTER_LAYER_CLASS(Silence); } // namespace caffe

仅仅是在反向的时候将diff置为0.

查到如下相关解释,

The use of this layer is simply to avoid that the output of unused blobs is reported in the log. 
Being an output manager layer, it is obviously zero its gradient. For instance, let us assume we are using AlexNet and we change the bottom of the 'fc7' layer to 'pool5' instead of 'fc6'.
If we do not delete the 'fc6' blob declaration, this layer is not used anymore but its ouput will be printed in stderr:
it is considered as an output of the whole architecture.
If we want to keep 'fc6' for some reasons, but without showing its values, we can use the 'SilenceLayer'.

SilenceLayer的作用就是避免在log中打印并没有使用的blobs的信息。作为一个output的管理层,梯度是0。

举例就是,我们在使用AlexNet,我们将fc7的bottom由fc6改为pool5,而且我们不想删除fc6声明的话,此时fc6 layer虽然不会用到但是会输出错误信息到stderr,

我们此时可以通过使用slicence layer 来保存fc6声明,而且不会报错。

参考:

https://stackoverflow.com/questions/42172871/explain-silence-layer-in-caffe

https://blog.csdn.net/Soleilhao/article/details/71775643

caffe-----silence layer 作用的更多相关文章

  1. Caffe中Layer注册机制

    Caffe内部维护一个注册表用于查找特定Layer对应的工厂函数(Layer Factory的设计用到了设计模式里的工厂模式).Caffe的Layer注册表是一组键值对(key, value)( La ...

  2. caffe自定义layer

    caffe自带layers: http://caffe.berkeleyvision.org/tutorial/layers.html Layers: Image Data - read raw im ...

  3. Caffe学习--Layer分析

    Caffe_Layer 1.基本数据结构 //Layer层主要的的参数 LayerParamter layer_param_; // protobuf内的layer参数 vector<share ...

  4. 转caffe scale layer

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/u011681952/article/det ...

  5. caffe rpn layer 中的 reshape layer

    Reshape层:(改变blob的形状,N,C,W,H) layer { name: "reshape" type: "Reshape" bottom: &qu ...

  6. unity之Layer作用

    1.使用layer做分层渲染 创建两个物体 添加AB两个层级 分别为两个物体设置对应的层级 为摄像机选择渲染层次(在这个例子中,取消对B层的渲染) 在游戏界面中,将不会显示B层的游戏对象

  7. caffe 学习(3)——Layer Catalogue

    layer是建模和计算的基本单元. caffe的目录包含各种state-of-the-art model的layers. 为了创建一个caffe model,我们需要定义模型架构在一个protocol ...

  8. caffe杂

    一.finetune命令: mpirun /home/zhangsuosheng/caffe_mpi/build/tools/caffe train -solver solver.prototxt - ...

  9. caffe源码学习

    本文转载自:https://buptldy.github.io/2016/10/09/2016-10-09-Caffe_Code/ Caffe简介 Caffe作为一个优秀的深度学习框架网上已经有很多内 ...

随机推荐

  1. VMware的linux虚拟机配置ip后无法ping通宿主机

    VMware的linux虚拟机配置ip(使用eth0)后无法ping通宿主机,同样宿主机无法ping通linux虚拟机. 可能原因:linux虚拟机使用的网卡,与本机使用的网卡不同,配置成与本机一致的 ...

  2. eclipse中安装Activiti插件

    由于公司网络问题,不能在线安装,下载到本地的插件,安装也是各种问题,后面终于找到能安装的插件包 1.下载eclipse activiti插件包 链接:https://pan.baidu.com/s/1 ...

  3. cypress

    https://community.cypress.com/docs/DOC-14090 usb3.0 only支持

  4. 在CSS3中,可以利用transform功能来实现文字或图像的旋转、缩放、倾斜、移动这四种类型的变形处理

    CSS3中的变形处理(transform)属 transform的功能分类 1.旋转 transform:rotate(45deg); 该语句使div元素顺时针旋转45度.deg是CSS 3的“Val ...

  5. spring MVC 后端 接收 前端 批量添加的数据(简单示例)

    第一种方式:(使用ajax的方式) 前端代码: <%@ page contentType="text/html;charset=UTF-8" language="j ...

  6. electron限制只启动一个应用

    electron限制只启动一个应用 // ========================================================== // 限制只可以打开一个应用,2.x的文 ...

  7. linux运维、架构之路-MongoDB单机部署

    一.MongoDB介绍 MongoDB 是一个基于分布式文件存储的数据库.由 C++ 语言编写.旨在为 WEB 应用提供可扩展的高性能数据存储解决方案. MongoDB 是一个介于关系型数据库和非关系 ...

  8. HDU 3468:A Simple Problem with Integers(线段树+延迟标记)

    A Simple Problem with Integers Case Time Limit: 2000MS Description You have N integers, A1, A2, ... ...

  9. easyui tree 点击state=closed节点,每次重新加载数据

    http://blog.csdn.net/lovejavaloveworld/article/details/30052305 树控件读取URL.子节点的加载依赖于父节点的状态.当展开一个封闭的节点, ...

  10. 获取<a>标签值</a>的标签值及更改

    html代码: <a id="catelogue_div1_h5" onclick="catelogue_div1(event)">隐藏</a ...