Tips
How to add layers?
For common usage, you will need just four or probably only three steps to add new layers:
Suppose your layer is newLayer and the corresponding parameter class is newParameter
add
new_layer.hpptoinclude/caffe/layers/add
new_layer.cpptosrc/caffe/layers/and never forget to add the following command to your cpp file to register it in the layer factory:INSTANTIATE_CLASS(newLayer); REGISTER_LAYER_CLASS(new);[optional] add
new_layer.cutosrc/caffe/layersmodify the
src/caffe/proto/caffe.proto: define new message typenewParameterand add its instancenew_paramin the messageLayerParameter. Here, please pay attention to the comment ofLayerParameterto get the available layer-specific id and update the comment when you add a new layer parameter instance. You need to provide the next available layer-specific id (you can get it by increasing the old id by one).
Well, people are always seeking for higher performance and better understanding, so probably you are not satisfied with such a rough method mentioned above. If you want a more specific hands-on introduction and sharper insight, please visit https://github.com/BVLC/caffe/wiki/Development for an official tutorial.
Image Format
Caffe uses a BGR color channel scheme for reading image files. This is due to the underlying OpenCV implementation of imread. The assumption of RGB is a common mistake.
Makefile.config
Always remember to modify the Makefile.config to meet your project requirements.
Last updated