转caffe scale layer
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
Scale Layer是输入进行缩放和平移,常常出现在BatchNorm归一化后,Caffe中常用BatchNorm+Scale实现归一化操作(等同Pytorch中BatchNorm)
首先我们先看一下 ScaleParameter
message ScaleParameter {
// The first axis of bottom[0] (the first input Blob) along which to apply
// bottom[1] (the second input Blob). May be negative to index from the end
// (e.g., -1 for the last axis).
// 根据 bottom[0] 指定 bottom[1] 的形状
// For example, if bottom[0] is 4D with shape 100x3x40x60, the output
// top[0] will have the same shape, and bottom[1] may have any of the
// following shapes (for the given value of axis):
// (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60
// (axis == 1 == -3) 3; 3x40; 3x40x60
// (axis == 2 == -2) 40; 40x60
// (axis == 3 == -1) 60
// Furthermore, bottom[1] may have the empty shape (regardless of the value of
// "axis") -- a scalar multiplier.
// 例如,如果 bottom[0] 的 shape 为 100x3x40x60,则 top[0] 输出相同的 shape;
// bottom[1] 可以包含上面 shapes 中的任一种(对于给定 axis 值).
// 而且,bottom[1] 可以是 empty shape 的,没有任何的 axis 值,只是一个标量的乘子.
optional int32 axis = 1 [default = 1];
// (num_axes is ignored unless just one bottom is given and the scale is
// a learned parameter of the layer. Otherwise, num_axes is determined by the
// number of axes by the second bottom.)
// (忽略 num_axes 参数,除非只给定一个 bottom 及 scale 是网络层的一个学习到的参数.
// 否则,num_axes 是由第二个 bottom 的数量来决定的.)
// The number of axes of the input (bottom[0]) covered by the scale
// parameter, or -1 to cover all axes of bottom[0] starting from `axis`.
// Set num_axes := 0, to multiply with a zero-axis Blob: a scalar.
// bottom[0] 的 num_axes 是由 scale 参数覆盖的;
optional int32 num_axes = 2 [default = 1];
// (filler is ignored unless just one bottom is given and the scale is
// a learned parameter of the layer.)
// (忽略 filler 参数,除非只给定一个 bottom 及 scale 是网络层的一个学习到的参数.
// The initialization for the learned scale parameter.
// scale 参数学习的初始化
// Default is the unit (1) initialization, resulting in the ScaleLayer
// initially performing the identity operation.
// 默认是单位初始化,使 Scale 层初始进行单位操作.
optional FillerParameter filler = 3;
// Whether to also learn a bias (equivalent to a ScaleLayer+BiasLayer, but
// may be more efficient). Initialized with bias_filler (defaults to 0).
// 是否学习 bias,等价于 ScaleLayer+BiasLayer,只不过效率更高
// 采用 bias_filler 进行初始化. 默认为 0.
optional bool bias_term = 4 [default = false];
optional FillerParameter bias_filler = 5;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
Scale layer 在prototxt里面的书写:
layer {
name: "scale_conv1"
type: "Scale"
bottom: "conv1"
top: "conv1"
scale_param {
bias_term: true
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
例如在MobileNet中:
layer {
name: "conv6_4/scale"
type: "Scale"
bottom: "conv6_4/bn"
top: "conv6_4/bn"
param {
lr_mult: 1
decay_mult: 0
}
param {
lr_mult: 1
decay_mult: 0
}
scale_param {
bias_term: true
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
</div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-095d4a0b23.css" rel="stylesheet">
</div>
转caffe scale layer的更多相关文章
- Caffe中Layer注册机制
Caffe内部维护一个注册表用于查找特定Layer对应的工厂函数(Layer Factory的设计用到了设计模式里的工厂模式).Caffe的Layer注册表是一组键值对(key, value)( La ...
- caffe自定义layer
caffe自带layers: http://caffe.berkeleyvision.org/tutorial/layers.html Layers: Image Data - read raw im ...
- Caffe学习--Layer分析
Caffe_Layer 1.基本数据结构 //Layer层主要的的参数 LayerParamter layer_param_; // protobuf内的layer参数 vector<share ...
- caffe rpn layer 中的 reshape layer
Reshape层:(改变blob的形状,N,C,W,H) layer { name: "reshape" type: "Reshape" bottom: &qu ...
- caffe 学习(3)——Layer Catalogue
layer是建模和计算的基本单元. caffe的目录包含各种state-of-the-art model的layers. 为了创建一个caffe model,我们需要定义模型架构在一个protocol ...
- caffe源码学习
本文转载自:https://buptldy.github.io/2016/10/09/2016-10-09-Caffe_Code/ Caffe简介 Caffe作为一个优秀的深度学习框架网上已经有很多内 ...
- TensorRT加速 ——NVIDIA终端AI芯片加速用,可以直接利用caffe或TensorFlow生成的模型来predict(inference)
官网:https://developer.nvidia.com/tensorrt 作用:NVIDIA TensorRT™ is a high-performance deep learning inf ...
- 深度学习工具caffe具体安装指南
caffe安装指南-吐血整理 前言: 在一台系统环境较好的linux机器上能够非常easy的安装caffe,可是假设系统本身非常旧,又没有GPU的话.安装就太麻烦了,全部都得从头做起,本文档旨在尽可能 ...
- Caffe代码分析--crop_layer.cu
因为要修改Caffe crop layer GPU部分的代码,现将自己对这部分GPU代码的理解总结一下,请大家多多指教! crop layer完成的功能(以matlab的方式表示):A(N,C,H,W ...
随机推荐
- Redis与Redis 伪集群环境的搭建
一 .准备工作 GCC编译环境 ruby运行环境 安装ruby脚本运行包 二.环境安装 1.GCC环境 首先,因为redis是由C语言编写的,所以需要安装GCC环境,可以用 gcc -v 命令来检查是 ...
- [译]Vulkan教程(32)生成mipmap
[译]Vulkan教程(32)生成mipmap Generating Mipmaps 生成mipmap Introduction 入门 Our program can now load and ren ...
- PostgreSQL 安装 & 用户配置
一.为什么选择 PostgreSQL 自从MySQL被Oracle收购以后,PostgreSQL逐渐成为开源关系型数据库的首选. MySQL被oracle收购,innodb随之被oracle控制. 二 ...
- 02-Nginx配置
一.Nginx配置 1.创建Nginx运行使用的用户 www: / usr / sbin / groupadd www / usr / sbin / useradd -g www www 2.检查配置 ...
- laravel 5.5.39 升级到 5.5.45 出现 cookie 序列化异常问题的解决
把项目里的 laravel 5.5.39 升级到 5.5.45 后,出现如下报错: ErrorExceptionopenssl_encrypt() expects parameter 1 to be ...
- Web前端基础(12):JavaScript(六)
1. JS中的面向对象 创建对象的几种常用方法: 1.使用Object或对象字面量创建对象 2.工厂模式创建对象 3.构造函数模式创建对象 4.原型模式创建对象 1.1 使用Object或对象字面量创 ...
- css知识笔记:垂直居中(别只看,请实操!!!)
css实现元素的垂直居中. (尝试采用5W2H方法说明): 别只看,请实操!!! What: 1.这篇文档主要描述元素水平方向居中的几种最常见和最实用的几种方式,并说明优缺点. 2.写这篇文章的目的, ...
- expect 知识与示例说明
expect 知识与示例说明 2012/04/10 chenxin 2019/07/07 update Chenxin 参考 https://www.cnblogs.com/yinghao1991/p ...
- Centos7配置桥接网络
- Linux系统学习 八、SSH服务—SSH远程管理服务
1.SSH简介 ssh(安全外壳协议)是Secure Shell的缩写,是建立在应用层和传输层基础上的安全协议.传输的时候是经过加密的,防止信息泄露,比telnet(明文传递)要安全很多. ftp安装 ...