1
votes

I am trying to understand the caffe library. For that I run through step by step for feature_extraction.cpp and classification.cpp.

In those cpp files, I found out layers, prototxt file, caffemodel, net.cpp, caffe.pb.cc, caffe.pb.hfiles.

I know caffe is formed using different layers. So those layer files inside layer folder are used.

prototxt file is meant for the structure of a particular network such as googlenet, alexnet etc. Different net has different structure.

caffemodel is the trained model using caffe library for a specific type of net structure.

What do those net.cpp, caffe.pb.cc do? I mean how to understand their roles in forming this caffe deep learning network.

1
There is a good tutorial for caffe.Please see (christopher5106.github.io/deep/learning/2015/09/04/…) - batuman

1 Answers

3
votes

You understand correctly that caffe implements deep learning by stacking "layers" one on top of the other to form a "net".

'net.cpp'
Each layer works as a "functional block" and its behavior/implementation is defined in src/caffe/layers/<layer>.cpp, src/caffe/layers/<layer>.cu and include/caffe/layers/<layer>.hpp.
The code that actually "stack" all the layers into a net can be found (mostly) in net.cpp.

'caffe.pb.h', 'caffe.pb.cc'
In order to define the specific structure of a specific deep net architecture (e.g., AlexNet, GoogLeNet, ResNet etc.) caffe uses library. The specific format of caffe protocol buffer is defined in src/caffe/proto/caffe.proto. The caffe.proto is "compiled" using google protobuffer compiler to produce 'caffe.pb.h' and 'caffe.pb.cc' c++ code for parsing and processing caffe prototxt and caffemodel files.