Predict one image, based on a trained model, from command prompt.
Hello,
As a new user of caffe, there are a couple burning questions that have accumulated and this is one of them.
One thing I am wondering, is, given a particular .caffemodel file, and ONE image, how exactly do I go about predicting the result of the model on this image, from the command prompt? Am I to understand that the only way to do this is via Python and/or MATLAB?
Thanks.
Hello. U can use the "test" function of caffe by writing: caffe test -model my_model.prototxt - weights my_snapshot.caffemodel
As u only want to test on one image, give that image as input to your test data layer (you may want to give the mean_image as input too) in your my_model.prorotxt (test batch size is 1 in this case)
Add output layers in your model definition my_model.prorotxt, dependent on which output you want to have (loss, votes...)
@userfou
Thanks, I couple questions:
- How exactly is a mean_image generated? I asked this as a previous question but never got an answer.
- I only want to predict one image. Does it also have to be in LMDB format? This is the biggest question.
Thanks.
-
you can use the caffe binary file therefore by writing in the terminal: CAFFE_ROOT/.build_release/tools/compute_image_mean.bin your_dataset_lmdb your_mean.binaryproto
-
No it doesn't. See all the possibilities in the caffe layer catalogue in the "data layers" section http://caffe.berkeleyvision.org/tutorial/layers.html What I do is to change my data layer type to IMAGE_DATA and feed the data layer (source path) with a text file containing the path to the image and its label
I hope I could help :)
Thanks for discussing this but please use caffe-users for this -- this issues tracker is primarily for Caffe development discussion. Thanks!