This is a simple predictor which shows how to use c api for image classfication.
It uses opencv for image reading
// Models path for your model, you have to modify it std::string json_file = "model/Inception/Inception-BN-symbol.json"; std::string param_file = "model/Inception/Inception-BN-0126.params"; std::string synset_file = "model/Inception/synset.txt"; std::string nd_file = "model/Inception/mean_224.nd";
// Image size and channels int width = 224; int height = 224; int channels = 3;
make
Run:
./image-classification-predict apple.jpg
The only parameter is the path of the test image.
The model used in the sample can be downloaded here: http://pan.baidu.com/s/1sjXKrqX or here: http://data.mxnet.io/mxnet/models/imagenet/
If you don't run it in the mxnet root path, maybe you will need to copy lib folder here.
Xiao Liu
E-mail: liuxiao@foxmail.com
Homepage: www.liuxiao.org
pertusa (for Makefile and image reading check)
caprice-j (for reading function)
sofiawu (for sample model)
piiswrong and tqchen (for useful coding suggestions)