Sunday, October 4, 2015

Examples_001_Classifying ImageNet: using the C++ API


A simple C++ code is proposed in examples/cpp_classification/classification.cpp.
The classification example will be built as examples/classification.bin in your build directory.
In my case, caffe/build/examples/cpp_classification/



go to script folder, run python script to download the model to bvlc_reference_caffenet
~/caffe/scripts$ ./download_model_binary.py ../models/bvlc_reference_caffenet/
(
You may need to install python-yaml,
sudo apt-get install python-yaml
sudo apt-get install libyaml-dev
)



got o ~/caffe/data/ilsvrc12
run ./get_ilsvrc_aux.sh , to obtain ImageNet labels file


classify the cat image (examples/iamges/cat.jpg) using this command:

./build/examples/cpp_classification/classification.bin \
models/bvlc_reference_caffenet/deploy.prototxt \
models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel \
data/ilsvrc12/imagenet_mean.binaryproto \
data/ilsvrc12/synset_words.txt \
examples/images/cat.jpg



No comments:

Post a Comment