Cifar-10 example gets no prediction right.

123 views
Skip to first unread message

Robmosh

unread,
Apr 29, 2016, 8:07:21 AM4/29/16
to Caffe Users
Hi there,
I am relatively new to caffe and thus am trying to understand the examples.
Yesterday I have trained the cifar 10 example with the full_solver and no changes in the .prototxt.

After training I now want to make predictions in Python. Therefor I use

MODEL_FILE_FULL= '/usr/local/lib/python2.7/dist-packages/caffe/examples/caffe/cifar-10/cifar10_full.prototxt'

PRETRAINING_FILE_FULL= '/usr/local/lib/python2.7/dist-packages/caffe/examples/caffe/cifar-10/cifar10_full_iter_70000.caffemodel.h5'

IMAGE_FILE_LIST = list of images

mean = np.load('/usr/local/lib/python2.7/dist-packages/caffe/examples/caffe/cifar-10/mean.npy).reshape((3,32,32))

net = caffe.Classifier(MODEL_FILE_FULL, PRETRAINING_FILE_FULL, mean)
input_img = caffe.io.load_image(IMAGE_FILE_LIST.pop(0))
prediction = net.predict([input_img])

print 'prediction class:', prediction.argmax()

My problem now is, that i get class 3 as prediction for every image. I tested images from every class and always get the same result, where the probability of class the is around 8.8-01, thus very high for all images.

Has anybody had similar problems and a solution for this?
I already tested it with the short training and downloaded the cifar-10 data new.

Thanks!!!

Robmosh

unread,
May 2, 2016, 1:17:21 AM5/2/16
to Caffe Users
Can'take anybody help me with this problem?

Hossein Hasanpour

unread,
May 2, 2016, 4:12:00 AM5/2/16
to Caffe Users
Why dont you use the ipython notebook sample(located in examples directory) for this? its way easier and straight forward. use that and if the problem still persists post your question

Robmosh

unread,
May 3, 2016, 4:33:03 AM5/3/16
to Caffe Users
Which example do you mean? There is one for classification, in which a model is loaded via 
net = caffe.Net(model,_def, model_weights, caffe.TEST)
and the an image will be predicted with this net via
net.forward()
net.blo 
Then the probobilitys get printed.

I think that this is exactly the same like i do, with the different that i use the caffe.Classifier instead of caffe.Net.

zxdz...@gmail.com

unread,
Nov 13, 2017, 5:58:58 AM11/13/17
to Caffe Users
hi, I had got the same problem as yours. I use caffe.Net to predict, and always get the class 4. Have you solve this problem? I will be pgrateful if you or someone can help me. Thanks a lot!

在 2016年4月29日星期五 UTC+8下午8:07:21,Robmosh写道:
Reply all
Reply to author
Forward
0 new messages