Model Description Files

Table of Contents

Using Model Script Files

MyCaffe models are described by a model description prototxt file which is a text file containing a simple text script that describes each layer making up the model.

Each layer receives data input through their ‘bottom‘ blobs and sends data out through their ‘top‘ blobs.  Layers are linked together by linking the names of the bottom of one layer to the top of another by specifying the same name for each.

AI Model Script

The image above demonstrates this linkage with a connection shown between the DataLayer‘s top named “data”, which is linked to the InnerProductLayer‘s bottom named “data”.  When creating the network, these linkages are created and maintained within the Net object.

LeNet Model

The LeNet model[1] is a fairly simple example model used to learn the MNIST dataset of hand written characters.

LeNet Model for MNIST

The linkages of the model are shown via each arrow connecting one layer to the next in the model.  Starting at the DataLayer‘s, the data flows from the top, through each linkage, on down through the model ending at the AccuracyLayer and SoftmaxLossLayer.  When training, the gradients are calculated for each layer and propagate back up through the model allowing each layer to calculate and store the appropriate gradients.  After all gradients are calculated the Solver applies the gradients to adjust the weights of each learnable layer.

[1] Gradient Based Learning Applied to Document Recognition by Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner, 1998.