Su JK
Su JK

Reputation: 171

How to use the trained Caffe model for the current input image?

Newbie to Caffe.

I am trying to use the trained Convolutional neural network on MNIST dataset using Caffe deep learning framework.

Following the official tutorial.

Steps taken successfully:

./data/mnist/get_mnist.sh
./examples/mnist/create_mnist.sh
./examples/mnist/train_lenet.sh

Model was trained and stopped with the following message:

I1203 solver.cpp:133] Snapshotting solver state to lenet_iter_10000.solverstate
I1203 solver.cpp:78] Optimization Done.

Now, I am not sure as how to get a testing image and use the existing trained model which I believe has been snapshot by the name lenet_iter_10000.solverstate to see the predicted scores for each class.

Upvotes: 1

Views: 3529

Answers (1)

Harsh Wardhan
Harsh Wardhan

Reputation: 2148

Use the test function of caffe:

<path to caffe root>/caffe test -model <val filename>.prototxt -weights lenet_iter_10000.caffemodel

As you want to test only one image, give that image as input to your test data layer. Use the mean_image as input as well in your <val filename>.protoxt. Test batch size is 1 in this case.

Also note that lenet_iter_10000.solverstate is not your trained model. Your trained model is actually lenet_iter_10000.caffemodel. To know about the diffrence between solverstate and caffemodel files see here.

Upvotes: 1

Related Questions