This demo shows how Caffe2 trains models, saves params and works with C++ language. Generally, Caffe2 has a tool called run_plan which is a counterpart of the executable caffe of Caffe1. We can train model with run_plan in command line and use the trained params in C++. The process is almost the same as Caffe1.
change the value of CAFFE2_PREFIX in the makefile according to your customized installation location.
make datasetmake clean && make trainmake testcheck out accuracy.txt to verify whether the model is properly trained.
make predictoryou can use the predictor to classify single channel 28x28 mnist like handwriting pics. There are some samples extracted from MNIST. You can test on them with the following command.
./predictor -i imgs/0.bmp