c++ script for calculating top-5 error from Imagenet

159 views
Skip to first unread message

Ihsan Ullah

unread,
Jul 31, 2015, 2:18:49 PM7/31/15
to Caffe Users
Hi all,
Can any body share code in c++ for calculating top-5 error from imagenet test output. 
Regards
Ihsan

林子達

unread,
Aug 2, 2015, 10:28:08 PM8/2/15
to Caffe Users

I have python script  for calculating top-5 error from imagenet test output. Is it ok to you?

Ihsan Ullah

unread,
Sep 5, 2015, 1:42:09 PM9/5/15
to Caffe Users
Hi, Can you kindly send it. I hope it will works. although i didnt used python. But i will try. 
Regards

林子達

unread,
Sep 6, 2015, 9:01:52 AM9/6/15
to Ihsan Ullah, Caffe Users
Hi 
  You can refer to it. Put the python file to  $caffe/examples 
https://gist.github.com/tzutalin/15c78fa10683a414cee4

Specify mode , weight, mean file, and 
MODEL_FILE = '../../models/darren_caffenet_objects11/deploy.prototxt' 
PRETRAINED = '../../models/darren_caffenet_objects11/darren11_caffenet_iter_100000.caffemodel' meanFile=np.load(caffe_root + 'python/caffe/imagenet/ilsvrc_2012_mean.npy').mean(1).mean(1)

Create a test.txt, and its format is like bellow:
carFilePath1 0
carFilePath2 0
...
dogFilePath 1
dogFilePath 2
...

--
You received this message because you are subscribed to a topic in the Google Groups "Caffe Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/caffe-users/gd_DtEA-zLU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/0d2883c2-4824-4b39-9e2a-a4c9dd12662b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--



Regards, 

Ihsan Ullah

unread,
Sep 6, 2015, 9:45:27 AM9/6/15
to Caffe Users, ihsan...@gmail.com
Thank you for your reply. 
I did all the steps you mentioned. I also make pycaffe. but as i didn't worked with python, 
Now i am confused what to do. How to calculate execute it from the linux terminal. 
Can you kindly guide me. I did the following but it gave me following error

ihs@acluster:/scr/ihsa/caffe/examples$ python test_caffe_accuracy.py
Traceback (most recent call last):
  File "test_caffe_accuracy.py", line 17, in <module>
    import caffe
ImportError: No module named caffe

Regards

Ihsan Ullah

unread,
Sep 6, 2015, 10:13:17 AM9/6/15
to Caffe Users, ihsan...@gmail.com
I added even python caffe path. (as given below) but still it is giving me same error. 

:/scr/ihsa/caffe/examples$ PYTHONPATH=/caffe/python/
ihs@acluster::/scr/ihsa/caffe/examples$ export PATH=$PYTHONPATH:$PATH
ihs@acluster::/scr/ihsa/caffe/examples$ echo $PYTHONPATH
/caffe/python/
ihs@acluster::/scr/ihsa/caffe/examples$ python test_caffe_accuracy.py
Traceback (most recent call last):
  File "test_caffe_accuracy.py", line 17, in <module>
    import caffe
ImportError: No module named caffe


On Sunday, September 6, 2015 at 3:01:52 PM UTC+2, 林子達 wrote:
Reply all
Reply to author
Forward
0 new messages