Skip to content

Latest commit

 

History

History
51 lines (33 loc) · 1.87 KB

README.md

File metadata and controls

51 lines (33 loc) · 1.87 KB

Compact Generalized Non-local Network in Caffe

The implementation of Compact Generalized Non-local (CGNL) Module in Caffe for multiple computer vision tasks.

introfig

Generated by Netscope

Notes:

The reason why I update to add the Caffe prototxt is that I implement this method into my recent training tasks and it works well. There are subtle differences between the PyTorch implementation and this simple Caffe re-implementation. This re-implementation is just an example for the proof of the concept. So it is not intended to reproduce the results reported in PyTorch implementation. The Non-local (NL) network in Caffe can be also build easily following the CGNL prototxt.

Getting Start

Prepare Caffe

Follow the official instruction to prepare the Caffe with successful compilation. Here we use CAFEE_ROOT to indicate the Caffe repo directory.

Add Layers

  • Copy source layers:
cp caffe/src/caffe/layers/* ${CAFFE_ROOT}/src/caffe/layers/
  • Copy include layers:
cp caffe/include/caffe/layers/* ${CAFFE_ROOT}/include/caffe/layers/
  • Add the following lines of code into ${CAFFE_ROOT}/src/caffe/proto/caffe.proto:
message LayerParameter {
    // Use the next available layer-specific ID in your Caffe.
    optional PermuteParameter permute_param = 149; 
}

message PermuteParameter {
    // The new orders of the axes of data. Notice it should be with
    // in the same range as the input data, and it starts from 0.
    // Do not provide repeated order.
    repeated uint32 order = 1;
}

Reference

Permute Layer in SSD and Matrix Multiplication Layer.