-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Viewing class probabilities assigned to images associated with test protobuf file, using either python wrappers or test_net.cpp #391
Comments
Hi danig, In test_net.cpp I see below code int total_iter = atoi(argv[3]); double test_accuracy = 0; I think you should use const vector<shared_ptr<Blob > >& blobs = caffe_test_net.blobs(); instead of ->blobs() ? |
Hi Danny, Happy to see Caffe applied to astronomy! Sorry for the frustration trying to extract the predictions. The latest release includes an overhauled python interface that's much easier to use. It can yield predictions on your training and test sets plus any new inputs in deployment. Since you are interested in the predictions on your test set, you should load your test net and then run the forward pass without any arguments to do a "prefilled" pass populated by data from your test leveldb. The next call will predict the next batch of inputs, and so forth. It'll look something like:
You might want to take a look at our classifier example too. Hope this helps! |
Hi Evan, Thanks very much for the helpful response! The new python wrapper is very intuitive and easy to use. However, after pulling the most recent version of caffe from master, recompiling the code, and retraining my net, I'm still having a strange issue accessing the softmax probabilities for my test set. I ran
Now, when I iterate through
The weirder thing is that when I call Any idea what's going on here? Apologies if I'm missing something really obvious, and thanks in advance for your help. Danny |
Did you upgrade the model prototxt and binaryproto according to the release notes https://github.com/BVLC/caffe/releases/tag/v0.999 ? Do you get good results when running the net on the test set with the If your training set is not class-balanced so that each class shows up an equal number of times, you should try re-training with a balanced data set. On Fri, May 23, 2014 at 11:57 AM, Danny Goldstein
|
Yes and yes. The results of the |
Closing since this should be fixed in the latest release, but give a shout on the caffe-users mailing list when you have a chance to try it! |
why out['prob'] has 2 values? |
@RoroKA Softmax outputs have to sum to 1, so it doesn't make sense for Softmax to return just one value. If p is the first probability, the second probability is 1-p. Ask on Stackoverflow or the Caffe Users mailing list for more info. |
I just got confused
but after focusing I realized that
Thanks a lot for your help
…On Wed, Dec 14, 2016 at 4:33 PM, Jonathan R. Williford < ***@***.***> wrote:
@RoroKA <https://github.com/RoroKA> Softmax outputs have to sum to 1, so
it doesn't make sense for Softmax to return just one value. If p is the
first probability, the second probability is 1-p. Ask on Stackoverflow or
the Caffe Users mailing list for more info.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#391 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AXLH7WYxefpI_cQfkKstFpq0ov7V3JSlks5rH_5WgaJpZM4B4Npq>
.
--
Best Regards,
Rehab Kotb Ali
Research Assistant
Center of Nano-electronics and Devices (CND)
The American University in Cairo
Zewail City of Science and Technology
|
I got the following error.Who can help me?Thanks. Traceback (most recent call last): |
Hi all,
I've successfully trained a slightly tweaked version of LeNet on my own dataset, which consists of ~80,000 1-channel 21x21-pixel astronomical images produced by the Palomar Transient Factory. I followed the standard training procedure: I split my data into two leveldbs,
train
andtest
, linked each to an appropriateprotobuf
file (train.protobuf
andtest.protobuf
), then linked eachprotobuf
file to a higher-levelprotobuf
file specifying the structure of my net.I am able to run both
train_net.bin
andtest_net.bin
and produce overall accuracy scores for the classifier. However, what I need are individual class probabilities for each image in the leveldb associated with mytest
protobuf file.I have tried to produce these in a variety of ways. First, I followed the suggestions that @shelhamer made in #281. I attempted to modify
test_net.cpp
by defining this variable:after the execution of the
Forward
pass, then accessing its contents to try to get the probabilities. However, I get a compile error just from adding that line after the forward pass:Next, I try using the python wrappers to access the probabilities via
net.blobs['prob']
, but I get an array with all entries = 0.Finally, I try loading my trained net as a
caffe.ImagenetClassifier
to expose thepredict
method. However, when I try to call predict on one of the raw images from my testingprotobuf
file, I get the following error:I would really appreciate a clear explanation of how to access the probabilities.
Thanks,
Danny
The text was updated successfully, but these errors were encountered: