Skip to content
Search

Caffe:Tour:LayerCatalogue

lastmod 2018-08-17created 2015-11-185 edits

To create a Caffe model you need to define the model architecture in a protocol buffer definition file (prototxt).

Vision Layers

  • Header: include/caffe/vision_layers.hpp

Vision layers generally take an acquired image as input (INPUT) and produce another image as output (OUTPUT). 1

  • Convolution
  • Pooling
  • Local Response Normalization (LRN)
  • im2col

Loss Layers

Loss drives learning by comparing an output to a target and assigning cost to minimize. The loss itself is computed by the forward pass and the gradient w.r.t. to the loss is computed by the backward pass.

  • Softmax
  • Sum-of-Squares / Euclidean
  • Hinge / Margin
  • Sigmoid Cross-Entropy
  • Infogain
  • Accuracy and Top-k

Activation / Neuron Layers

In general, activation / Neuron layers are element-wise operators, taking one bottom blob and producing one top blob of the same size.

  • ReLU / Rectified-Linear and Leaky-ReLU
  • Sigmoid
  • TanH / Hyperbolic Tangent
  • Absolute Value
  • Power
  • BNLL

Data Layers

Data enters Caffe through data layers: they lie at the bottom of nets. Data can come from efficient databases (LevelDB or LMDB), directly from memory, or, when efficiency is not critical, from files on disk in HDF5 or common image formats.

  • Database
  • In-Memory
  • HDF5 Input
  • HDF5 Output
  • Images
  • Windows
  • Dummy

Common Layers

Inner Product

  • num_output: the number of filters.
    (Probably) the last layer uses this value to classify the labels (Label or Filter). Pay attention to the num_output value in the last layer of train_val.prototxt and deploy.prototxt. 2
layer {
  name: "fc8"
  type: "InnerProduct"
  # ...
  inner_product_param {
    num_output: 1000
    # ...
  }
  # ...
}

Splitting

Flattening

Reshape

Concatenation

Slicing

Elementwise Operations

Argmax

Softmax

Mean-Variance Normalization

See also

Favorite site

References


  1. Original text: Vision layers usually take images as input and produce other images as output. ↩

  2. what is batch_size mean? #585 ↩