tree: a398fbf20311875ee632dd391791481731aa8cce [path history] [tgz]

Use parameters pre-trained from Caffe in SINGA

In this example, we use SINGA to load the VGG parameters trained by Caffe to do image classification.

Run this example

You can run this example by simply executing vgg16 or vgg19 The script does the following work.

Obtain the Caffe model

  • Download caffe model prototxt and parameter binary file.
  • Currently we only support the latest caffe format, if your model is in previous version of caffe, please update it to current format.(This is supported by caffe)
  • After updating, we can obtain two files, i.e., the prototxt and parameter binary file.

Prepare test images

A few sample images are downloaded into the test folder.


The script creates the VGG model and read the parameters,

usage: [-h] model_txt model_bin imgclass

where imgclass refers to the synsets of imagenet dataset for vgg models. You can start the prediction program by executing the following command:

python vgg16.prototxt vgg16.caffemodel synset_words.txt

Then you type in the image path, and the program would output the top-5 labels.

More Caffe models would be tested soon.