Snapdragon Neural Processing Engine SDK
Reference Guide
Caffe & Caffe2 Model Conversion

Machine Learning frameworks have specific formats for storing neural network models. SNPE supports these various models by converting them to a framework neutral deep learning container (DLC) format. The DLC file is used by the SNPE runtime for execution of the neural network.

Converting Models from Caffe to DLC

A trained Caffe model consists of:

  • Caffe prototxt file with the network definition (net_definition.prototxt)
  • Caffe binary proto file with weights and biases (trained_model.caffemodel)

The snpe-caffe-to-dlc tool converts a Caffe model into an equivalent SNPE DLC file. The following command will convert an AlexNet Caffe model into a SNPE DLC file.

snpe-caffe-to-dlc --caffe_txt $SNPE_ROOT/models/alexnet/caffe/deploy.prototxt
                  --caffe_bin $SNPE_ROOT/models/alexnet/caffe/bvlc_alexnet.caffemodel
                  --dlc alexnet.dlc

The AlexNet model files can be obtained by following the Getting AlexNet tutorial.

Converting Models from Caffe2 to DLC

A trained Caffe2 model consists of:

  • Binary protobuf file with the network definition
  • Binary protobuf file with weights and biases

The snpe-caffe2-to-dlc tool converts a Caffe2 model into an equivalent SNPE DLC file. The following command will convert an AlexNet Caffe2 model into a SNPE DLC file.

snpe-caffe2-to-dlc --predict_net predict_net.pb
                   --exec_net exec_net.pb
                   --input_dim data 1,3,227,227
                   --dlc alexnet.dlc

The AlexNet model files can be obtained from the Caffe2 project on Github.