Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caffe.Classifier() and caffe.Net() have different class predictions for same image? #3667

Closed
NightFury13 opened this issue Feb 12, 2016 · 1 comment

Comments

@NightFury13
Copy link

Is there a difference in the way the predictions work in the case of caffe.Classifier() and caffe.Net()? I have an image (linked below) that when run in the caffe-example (classification.ipynb) gives a prediction of class 287 (net.predict([img]).argmax()). However, if I use this image in the another example (filter_visualization.ipynb) the class probabilites (net.blobs['prob'].argmax()) comes out to be 2! Is there something trivial that I am missing or this really shouldn't be happening? Which of these is the correct classification if at all one is correct (I have tweaked the cat image a little bit to see what are the effects on classification)?

I am using the bvlc_reference_caffenet.caffemodel and the corresponding deploy.prototxt with the imagenet mean image provided in caffe as default (ilsvrc12).

Sample cat image : advr_out

@seanbell
Copy link

Yes, the two are very different, and you should expect different answers. Look at the code -- Classifier.predict does oversampling and calls Net.forward_all: https://github.com/BVLC/caffe/blob/master/python/caffe/classifier.py#L47

Also, in the future please ask for usage help on the mailing list. From https://github.com/BVLC/caffe/blob/master/CONTRIBUTING.md:

Please do not post usage, installation, or modeling questions, or other requests for help to Issues.
Use the caffe-users list instead. This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants