caffe中activation function的形式,直接决定了其训练速度以及SGD的求解。

在caffe中,不同的activation function对应的sgd的方式是不同的,因此,在配置文件中指定activation layer的type,目前caffe中用的最多的是relu的activation function.

caffe中,目前实现的activation function有以下几种:

absval, bnll, power, relu, sigmoid, tanh等几种,分别有单独的layer层。其数学公式分别为:

算了,这部分我不解释了,直接看caffe的tutorial

ReLU / Rectified-Linear and Leaky-ReLU

  • LayerType: RELU
  • CPU implementation: ./src/caffe/layers/relu_layer.cpp
  • CUDA GPU implementation: ./src/caffe/layers/relu_layer.cu
  • Parameters (ReLUParameter relu_param)
    • Optional

      • negative_slope [default 0]: specifies whether to leak the negative part by multiplying it with the slope value rather than setting it to 0.
  • Sample (as seen in ./examples/imagenet/imagenet_train_val.prototxt)

    layers {
    name: "relu1"
    type: RELU
    bottom: "conv1"
    top: "conv1"
    }

Given an input value x, The RELU layer computes the output as x if x > 0 and negative_slope * x if x <= 0. When the negative slope parameter is not set, it is equivalent to the standard ReLU function of taking max(x, 0). It also supports in-place computation, meaning that the bottom and the top blob could be the same to preserve memory consumption.

Sigmoid

  • LayerType: SIGMOID
  • CPU implementation: ./src/caffe/layers/sigmoid_layer.cpp
  • CUDA GPU implementation: ./src/caffe/layers/sigmoid_layer.cu
  • Sample (as seen in ./examples/imagenet/mnist_autoencoder.prototxt)

    layers {
    name: "encode1neuron"
    bottom: "encode1"
    top: "encode1neuron"
    type: SIGMOID
    }

The SIGMOID layer computes the output as sigmoid(x) for each input element x.

TanH / Hyperbolic Tangent

  • LayerType: TANH
  • CPU implementation: ./src/caffe/layers/tanh_layer.cpp
  • CUDA GPU implementation: ./src/caffe/layers/tanh_layer.cu
  • Sample

    layers {
    name: "layer"
    bottom: "in"
    top: "out"
    type: TANH
    }

The TANH layer computes the output as tanh(x) for each input element x.

Absolute Value

  • LayerType: ABSVAL
  • CPU implementation: ./src/caffe/layers/absval_layer.cpp
  • CUDA GPU implementation: ./src/caffe/layers/absval_layer.cu
  • Sample

    layers {
    name: "layer"
    bottom: "in"
    top: "out"
    type: ABSVAL
    }

The ABSVAL layer computes the output as abs(x) for each input element x.

Power

  • LayerType: POWER
  • CPU implementation: ./src/caffe/layers/power_layer.cpp
  • CUDA GPU implementation: ./src/caffe/layers/power_layer.cu
  • Parameters (PowerParameter power_param)
    • Optional

      • power [default 1]
      • scale [default 1]
      • shift [default 0]
  • Sample

    layers {
    name: "layer"
    bottom: "in"
    top: "out"
    type: POWER
    power_param {
    power: 1
    scale: 1
    shift: 0
    }
    }

The POWER layer computes the output as (shift + scale * x) ^ power for each input element x.

BNLL

  • LayerType: BNLL
  • CPU implementation: ./src/caffe/layers/bnll_layer.cpp
  • CUDA GPU implementation: ./src/caffe/layers/bnll_layer.cu
  • Sample

    layers {
    name: "layer"
    bottom: "in"
    top: "out"
    type: BNLL
    }

The BNLL (binomial normal log likelihood) layer computes the output as log(1 + exp(x)) for each input element x.

caffe中的sgd,与激活函数(activation function)的更多相关文章

  1. 激活函数-Activation Function

    该博客的内容是莫烦大神的授课内容.在此只做学习记录作用. 原文连接:https://morvanzhou.github.io/tutorials/machine-learning/tensorflow ...

  2. 浅谈深度学习中的激活函数 - The Activation Function in Deep Learning

    原文地址:http://www.cnblogs.com/rgvb178/p/6055213.html版权声明:本文为博主原创文章,未经博主允许不得转载. 激活函数的作用 首先,激活函数不是真的要去激活 ...

  3. The Activation Function in Deep Learning 浅谈深度学习中的激活函数

    原文地址:http://www.cnblogs.com/rgvb178/p/6055213.html 版权声明:本文为博主原创文章,未经博主允许不得转载. 激活函数的作用 首先,激活函数不是真的要去激 ...

  4. 《Noisy Activation Function》噪声激活函数(一)

    本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/51736830 Noisy Activa ...

  5. MXNet 定义新激活函数(Custom new activation function)

    https://blog.csdn.net/weixin_34260991/article/details/87106463 这里使用比较简单的定义方式,只是在原有的激活函数调用中加入. 准备工作下载 ...

  6. 激活函数:Swish: a Self-Gated Activation Function

    今天看到google brain 关于激活函数在2017年提出了一个新的Swish 激活函数. 叫swish,地址:https://arxiv.org/abs/1710.05941v1 pytorch ...

  7. TensorFlow Activation Function 1

    部分转自:https://blog.csdn.net/caicaiatnbu/article/details/72745156 激活函数(Activation Function)运行时激活神经网络中某 ...

  8. caffe中各层的作用:

    关于caffe中的solver: cafffe中的sover的方法都有: Stochastic Gradient Descent (type: "SGD"), AdaDelta ( ...

  9. ML 激励函数 Activation Function (整理)

    本文为内容整理,原文请看url链接,感谢几位博主知识来源 一.什么是激励函数 激励函数一般用于神经网络的层与层之间,上一层的输出通过激励函数的转换之后输入到下一层中.神经网络模型是非线性的,如果没有使 ...

随机推荐

  1. Android Studio 2.2以上支持了Cmake的配置JNI的相关参数

    Android Studio 2.2以上支持了Cmake的配置JNI的相关参数,简化了通过Android.mk配置.并很好的继承了C++的编辑方式.以下是对应的引入第三方so和第三方.cpp文件的路径 ...

  2. Json JsonUtility对字典/列表的序列化,反序列化

    Unity5.3从开始追加的JsonUtility,但是对于List 和Dictionary不能被直接序列化存储. 例如: 数据模型: using UnityEngine; using System; ...

  3. `aclocal-1.10' is missing on your system

    root@ubuntu31:~/linux-ftools-master# makecd . && /bin/bash /root/linux-ftools-master/missing ...

  4. 性能测试工具LoadRunner08-LR之Virtual User Generator 检查点

    步骤: 1.点击Vuser--->Run-Time Settings 2.点击Preferences--->Enable Image and text check 3.点击Content ...

  5. Unity3D跨平台动态库编译---记kcp基于CMake的各平台构建实践

    一 为什么需要动态库 1)提供原生代码(native code)的支持,也叫原生插件,但是我实践的是c/cpp跨平台动态库,这里不具体涉及安卓平台java库和ios平台的objectc库构建. 2)某 ...

  6. contiki源码阅读之list

    我们阅读一下contiki的源码,list.c(路径是./core/lib/list.h). #include "lib/list.h" #define NULL 0 struct ...

  7. netty之==TCP粘包/拆包问题解决之道(一)

    一.TCP粘包/拆包是什么 TCP是一个“流”协议,所谓流,就是没有界限的一长串二进制数据.TCP作为传输层协议并不不了解上层业务数据的具体含义,它会根据TCP缓冲区的实际情况进行数据包的划分,所以在 ...

  8. 使用 Notapad++ 进行 Java 开发

    准备工具 1.安装 JDK 以及配置相关环境变量: 2.安装 64 位版的 Notepad++ : 2.一台 64 位 Windows 系统电脑: 一.下载&安装Notepad++ 官网下载地 ...

  9. SpringMVC快速入门

    导入开发包 前6个是Spring的核心功能包[IOC],第7个是关于web的包,第8个是SpringMVC包 org.springframework.context-3.0.5.RELEASE.jar ...

  10. 用Python爬虫对豆瓣《敦刻尔克》影评进行词云展示

    最近很想看的一个电影,去知乎上看一下评论,刚好在学Python爬虫,就做个小实例. 代码基于第三方修改 原文链接  http://python.jobbole.com/88325/#comment-9 ...