This is a simple predictor which shows how to use the MXNet C Predict API for image classification with a pre-trained ImageNet model in a single thread and multiple threads.
USE_OPENCV is set to true by default when building from sourcemodel/Inception/ subfolder, or if not, you will need to edit the source file and update the paths in the Build step.image-classification-predict.cc file, and change the following lines to your artifacts' paths:// 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 the example by passing it an image that you want to classify. If you don't have one handy, run the following to get one:
wget https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Honeycrisp.jpg/1920px-Honeycrisp.jpg
Then run the image-classification-predict program, passing the image as the first argument and the number of threads as the second parameter.
./image-classification-predict 1920px-Honeycrisp.jpg 1
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)