TanH / Hyperbolic Tangent

  • 类型(type):TanH
  • CPU 实现: ./src/caffe/layers/tanh_layer.cpp
  • CUDA、GPU实现: ./src/caffe/layers/tanh_layer.cu

  • 例子

    layer {
    name: "layer"
    bottom: "in"
    top: "out"
    type: "TanH"
    }

    对于每一个输入值x,TanH layer的输出为tanh(x)。

  • Absolute Value

    • 类型(type):AbsVal
    • CPU 实现: ./src/caffe/layers/absval_layer.cpp
    • CUDA、GPU实现: ./src/caffe/layers/absval_layer.cu

    • 例子

    • layer {
      name: "layer"
      bottom: "in"
      top: "out"
      type: "AbsVal"
      }

      对于每一个输入值x,AbsVal layer的输出为abs(x)。

      Power

        • 类型(type):Power
        • CPU 实现: ./src/caffe/layers/power_layer.cpp
        • CUDA、GPU实现: ./src/caffe/layers/power_layer.cu
        • 参数 (power_param):

          • 可选:

            • power [default 1](指数,默认为1)
            • scale [default 1](比例,默认为1)
            • shift [default 0](偏移,默认为0)
        • 例子

      layer {
      name: "layer"
      bottom: "in"
      top: "out"
      type: "Power"
      power_param {
      power:
      scale:
      shift:
      }
      }

      对于每一个输入值x,Power layer的输出为(shift + scale * x) ^ power。

      BNLL

      • 类型(type):BNLL(二项正态对数似然,binomial normal log likelihood)
      • CPU 实现: ./src/caffe/layers/bnll_layer.cpp
      • CUDA、GPU实现: ./src/caffe/layers/bnll_layer.cu
      • 例子
      • layer {
        name: "layer"
        bottom: "in"
        top: "out"
        type: BNLL
        }

        对于每一个输入值x,BNLL layer的输出为log(1 + exp(x))。

      • --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      • Data Layers

        Data 通过Data Layers进入Caffe,Data Layers位于Net的底部。
        Data 可以来自:1、高效的数据库(LevelDB 或 LMDB);2、内存;3、HDF5或image文件(效率低)。
        基本的输入预处理(例如:减去均值,缩放,随机裁剪,镜像处理)可以通过指定TransformationParameter达到。

        Database

        • 类型(type):Data(数据库)
        • 参数:
          • 必要:

            • source: the name of the directory containing the database(数据库名称)
            • batch_size: the number of inputs to process at one time(每次处理的输入的数据量)
          • 可选:
            • rand_skip: skip up to this number of inputs at the beginning; useful for asynchronous sgd(在开始的时候跳过这个数值量的输入;这对于异步随机梯度下降是非常有用的)
            • backend [default LEVELDB]: choose whether to use a LEVELDB or LMDB(选择使用LEVELDB 数据库还是LMDB数据库,默认为LEVELDB)

        In-Memory

        • 类型(type):MemoryData
        • 参数:
          • 必要:

            • batch_size, channels, height, width: specify the size of input chunks to read from memory(4个值,确定每次读取输入数据量的大小)

        Memory Data Layer从内存直接读取数据(而不是复制数据)。使用Memory Data Layer之前,必须先调用,MemoryDataLayer::Reset(C++方法)或Net.set_input_arrays(Python方法)以指定一个source来读取一个连续的数据块(4D,按行排列),每次读取大小由batch_size决定。

        HDF5 Input

        • 类型(type):HDF5Data
        • 参数:
          • 必要:

            • source: the name of the file to read from(读取的文件的名称)
            • batch_size(每次处理的输入的数据量)

        HDF5 Output

        • 类型(type):HDF5Output
        • 参数:

          • 必要:

            • file_name: name of file to write to(写入的文件的名称)

          HDF5 output layer与这部分的其他layer的功能正好相反,不是读取而是写入。

        Images

        • 类型(type):ImageData
        • 参数:
          • 必要:

            • source: name of a text file, with each line giving an image filename and label(一个text文件的名称,每一行指定一个image文件名和label)
            • batch_size: number of images to batch together(每次处理的image的数据)
          • 可选:
            • rand_skip: (在开始的时候跳过这个数值量的输入)
            • shuffle [default false](是否随机乱序,默认为否)
              -new_height, new_width: if provided, resize all images to this size(缩放所有的image到新的大小)

        Windows

        • 类型(type):WindowData
        • (没有详解)

        Dummy

        • 类型(type):DummyData

        DummyData 用于开发和测试,详见DummyDataParameter(没有给出链接)。

      • --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      • Common Layers

        Inner Product

          • 类型(type):Inner Product(全连接层)
          • CPU 实现: ./src/caffe/layers/inner_product_layer.cpp
          • CUDA、GPU实现: ./src/caffe/layers/inner_product_layer.cu
          • 参数 (inner_product_param):

            • 必要:

              • num_output (c_o): the number of filters(滤波器数目)
            • 强烈推荐:
              • weight_filler [default type: ‘constant’ value: 0](滤波器权重;默认类型为constant,默认值为0)
            • 可选:
              • bias_filler [default type: ‘constant’ value: 0](bias-偏置项的值,默认类型为constant,默认值为0)
              • bias_term [default true]: specifies whether to learn and apply a set
                of additive biases to the filter outputs(是否添加bias-偏置项,默认为True)
          • 输入(Input)

            • n * c_i * h_i * w_i
          • 输出(Output)

            • n * c_o * 1 * 1
          • 例子

        layer {
        name: "fc8" # 名称:fc8
        type: "InnerProduct" # 类型:全连接层
        # 权重(weights)的学习速率因子和衰减因子
        param { lr_mult: decay_mult: }
        # 偏置项(biases)的学习速率因子和衰减因子
        param { lr_mult: decay_mult: }
        inner_product_param {
        num_output: # 1000个滤波器(filters)
        weight_filler {
        type: "gaussian" # 初始化高斯滤波器(Gaussian)
        std: 0.01 # 标准差为0., 均值默认为0
        }
        bias_filler {
        type: "constant" # 初始化偏置项(bias)为零
        value:
        }
        }
        bottom: "fc7" # 输入层:fc7
        top: "fc8" # 输出层:fc8
        }

      InnerProduct layer(常被称为全连接层)将输入视为一个vector,输出也是一个vector(height和width被设为1)

      Splitting

      • 类型(type):Split

      Split layer用于将一个输入的blob分离成多个输出的blob。这用于当需要将一个blob输入至多个输出layer时。

      Flattening

      • 类型(type):Flatten

      Flatten layer用于把一个维度为n * c * h * w的输入转化为一个维度为 n * (c*h*w)的向量输出。

      Reshape

        • 类型(type):Reshape
        • CPU 实现: ./src/caffe/layers/reshape_layer.cpp
        • CUDA、GPU实现: 尚无
        • 参数 (reshape_param):

          • 可选:

            • shape(改变后的维度,详见下面解释)
        • 输入(Input)

          • a single blob with arbitrary dimensions(一个任意维度的blob)
        • 输出(Output)

          • the same blob, with modified dimensions, as specified by reshape_param(相同内容的blob,但维度根据reshape_param改变)
        • 例子

       layer {
      name: "reshape" # 名称:reshape
      type: "Reshape" # 类型:Reshape
      bottom: "input" # 输入层名称:input
      top: "output" # 输出层名称:output
      reshape_param {
      shape {
      dim: # 这个维度与输入相同
      dim:
      dim:
      dim: - # 根据其他维度自动推测
      }
      }
      }

      Reshape layer只改变输入数据的维度,但内容不变,也没有数据复制的过程,与Flatten layer类似。

      输出维度由reshape_param 指定,正整数直接指定维度大小,下面两个特殊的值:

      • 0 => 表示copy the respective dimension of the bottom layer,复制输入相应维度的值。
      • -1 => 表示infer this from the other dimensions,根据其他维度自动推测维度大小。reshape_param中至多只能有一个-1。

      再举一个例子:如果指定reshape_param参数为:{ shape { dim: 0 dim: -1 } } ,那么输出和Flattening layer的输出是完全一样的。

      Concatenation

        • 类型(type):Concat(连结层)
        • CPU 实现: ./src/caffe/layers/concat_layer.cpp
        • CUDA、GPU实现: ./src/caffe/layers/concat_layer.cu
        • 参数 (concat_param):

          • 可选:

            • axis [default 1]: 0 for concatenation along num and 1 for channels.(0代表连结num,1代表连结channel)
        • 输入(Input)
          -n_i * c_i * h * w for each input blob i from 1 to K.(第i个blob的维度是n_i * c_i * h * w,共K个)

        • 输出(Output)

          • if axis = 0: (n_1 + n_2 + … + n_K) * c_1 * h * w, and all input
            c_i should be the same.(axis = 0时,输出 blob的维度为(n_1 + n_2 + … + n_K) * c_1
            * h * w,要求所有的input的channel相同)
          • if axis = 1: n_1 * (c_1 + c_2 + … + c_K) * h * w, and all input n_i
            should be the same.(axis = 0时,输出 blob的维度为n_1 * (c_1 + c_2 + … + c_K) * h
            * w,要求所有的input的num相同)
        • 例子

          layer {
          name: "concat"
          bottom: "in1"
          bottom: "in2"
          top: "out"
          type: "Concat"
          concat_param {
          axis:
          }
          }

          Concat layer用于把多个输入blob连结成一个输出blob。

          Slicing

          Slice layer用于将一个input layer分割成多个output layers,根据给定的维度(目前只能指定num或者channel)。

          • 类型(type):Slice
          • 例子
          • layer {
            name: "slicer_label"
            type: "Slice"
            bottom: "label"
            ## 假设label的维度是:N x x x
            top: "label1"
            top: "label2"
            top: "label3"
            slice_param {
            axis: # 指定维度为channel
            slice_point: # 将label[~][][~][~]赋给label1
            slice_point: # 将label[~][][~][~]赋给label2
            # 将label[~][][~][~]赋给label3
            }
            }

            axis表明是哪一个维度,slice_point是该维度的索引,slice_point的数量必须是top blobs的数量减1.

            Elementwise Operations

            • 类型(type): Eltwise
            • (没有详解)

            Argmax

            • 类型(type):ArgMax
            • (没有详解)

            Softmax

            • 类型(type):Softmax
            • (没有详解)

            Mean-Variance Normalization

            • 类型(type):MVN
            • (没有详解)

Caffe : Layer Catalogue(2)的更多相关文章

  1. Caffe : Layer Catalogue(1)

    原文:http://caffe.berkeleyvision.org/tutorial/layers.html 参考:http://blog.csdn.net/u011762313/article/d ...

  2. 【caffe Layer】代码中文注释

    src/caffe/proto/caffe.proto 中LayerParameter部分 // NOTE // Update the next available ID when you add a ...

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

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

  4. caffe layer注册机制

    Caffe内部维护一个注册表用于查找特定Layer对应的工厂函数(Layer Factory的设计用到了设计模式里的工厂模式).Layer_factory的主要作用是负责Layer的注册,已经注册完事 ...

  5. caffe layer层cpp、cu调试经验和相互关系

    对于layer层的cpp文件,你可以用LOG和printf.cout进行调试,cu文件不能使用LOG,可以使用cout,printf. 对于softmaxloss的layer层,既有cpp文件又有cu ...

  6. Caffe(卷积神经网络框架)介绍

    Caffe(卷积神经网络框架)Caffe,全称Convolution Architecture For Feature Extraction caffe是一个清晰,可读性高,快速的深度学习框架.作者是 ...

  7. caffe 教程

    Caffe是一个清晰而高效的深度学习框架,本文详细介绍了caffe的优势.架构,网络定义.各层定义,Caffe的安装与配置,解读了Caffe实现的图像分类模型AlexNet,并演示了CIFAR-10在 ...

  8. 知乎:GAN 的发展对于研究通用人工智能有什么意义?

    https://www.zhihu.com/question/57668112/answer/155367561 Lyken 愿以有涯随无涯 收录于 编辑推荐知乎圆桌 · 296 人赞同了该回答 资历 ...

  9. 在Caffe添加Python layer详细步骤

    本文主要讨论的是在caffe中添加python layer的一般流程,自己设计的test_python_layer.py层只是起到演示作用,没有实际的功能. 1) Python layer 在caff ...

随机推荐

  1. ss命令,显示socket状态

    ss命令用于显示socket状态. 他可以显示PACKET sockets, TCP sockets, UDP sockets, DCCP sockets, RAW sockets, Unix dom ...

  2. oschina BI商业智能开源软件

    54款 BI商业智能开源软件 MySQL数据仓库解决方案 Infobright OLAP 分析引擎 Apache Kylin 数据处理和分发系统 Apache NiFi OLAP 数据查询引擎 Dru ...

  3. 【转】s3c2440 按键驱动 — 字符设备

    原文网址:http://www.xuebuyuan.com/632893.html 主机:VM - redhat 9.0 开发板:FL2440,linux-2.6.12 arm-linux-gcc:3 ...

  4. 2013第39周一Web打印

    2013第39周一Web打印 项目中遇到了Java Web打印问题,简单调用IE浏览器的打印不能完全满足要求,于是就搜集了Web打印相关的主题,简单汇总一下.web打印难点在分页.页面纸张设置,页眉页 ...

  5. 面试问题:关于java并发方面的

    主要是回答一下面试中可能会碰到的问题.慢慢的积累一下.一个星期以后,补全.

  6. HDU-1428(记忆化搜索)

    Problem Description LL 最近沉迷于AC不能自拔,每天寝室.机房两点一线.由于长时间坐在电脑边,缺乏运动.他决定充分利用每次从寝室到机房的时间,在校园里散散步.整个HDU 校园呈方 ...

  7. 就是一段程序,可以求出N个不等长列表中取N个元素形成的所有组合

    def get_result_in_vector(vector, N, tmp, tmp_result): """ :param vector:所有组合的拼接 :para ...

  8. Map的遍历方法及String和其它类型的相互转化

    Map的遍历方法: package com.lky.test; import java.util.HashMap; import java.util.Iterator; import java.uti ...

  9. 常用的MIME类型(资源的媒体类型)

    后缀名 MIME名称 *.3gpp audio/3gpp, video/3gpp *.ac3 audio/ac3 *.asf allpication/vnd.ms-asf *.au audio/bas ...

  10. js-权威指南学习笔记4

    第五章 语句 1.在JS中没有块级作用域,在语句块中声明的变量并不是语句块私有的. 2.尽管函数声明语句和函数定义表达式具有相同的函数名,但二者仍然不同.两种方式都创建了新的函数对象,但函数声明语句中 ...