Skip to content
Search

Caffe:Tour

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

Caffe is a deep learning framework and this tutorial explains its philosophy, architecture, and usage. This is a practical guide and framework introduction, so the full frontier, context, and history of deep learning cannot be covered here. While explanations will be given where possible, a background in machine learning and neural networks is helpful.

Philosophy

In one sip, Caffe is brewed for

  • Expression: models and optimizations are defined as plaintext schemas instead of code.
  • Speed: for research and industry alike speed is crucial for state-of-the-art models and massive data.
  • Modularity: new tasks and settings require flexibility and extension.
  • Openness: scientific and applied progress call for common code, reference models, and reproducibility.
  • Community: academic research, startup prototypes, and industrial applications all share strength by joint discussion and development in a BSD-2 project.

and these principles direct the project.

Nets, Layers, Blobs, Model

See Caffe:Develop#Blob, Caffe:Develop#Layer, and Caffe:Develop#Net, respectively.

Model

  • Model format: The models are defined in plaintext protocol buffer schema (prototxt) while the learned models are serialized as binary protocol buffer (binaryproto) .caffemodel files.

Forward, Backward

See Caffe:Tour:ForwardBackward.

Loss

The error produced by the given weights (Weight). If the network always outputs the correct result for all 1000 inputs, the loss is naturally 0. If it outputs wrong results for all of them, the loss becomes very high. Usually the loss value decreases as a CNN trains.

Layer Catalogue

See Caffe:Tour:LayerCatalogue.

Solver

See Caffe:Tour:Solver.

Interfaces

Data

This data layer definition:

layer {
  name: "mnist"
  # Data layer loads leveldb or lmdb storage DBs for high-throughput.
  type: "Data"
  # the 1st top is the data itself: the name is only convention
  top: "data"
  # the 2nd top is the ground truth: the name is only convention
  top: "label"
  # the Data layer configuration
  data_param {
    # path to the DB
    source: "examples/mnist/mnist_train_lmdb"
    # type of DB: LEVELDB or LMDB (LMDB supports concurrent reads)
    backend: LMDB
    # batch processing improves efficiency.
    batch_size: 64
  }
  # common data transformations
  transform_param {
    # feature scaling coefficient: this maps the [0, 255] MNIST data to [0, 1]
    scale: 0.00390625
  }
}

See also

Favorite site

References