In this example, we will using cifar10_quick_iter_5000.caffemodel as pre-trained model. And modified cifar10_quick_train_test.prototxt to get argmax for prediction.
Step1:Download the example from
Github
Step2:Copy files to caffe master directory.
Copy files to your caffe master directory. keep the same directories and subdirectories.
caffe-master/examples/images/cat10.png
caffe-master/examples/images/dog10.png
caffe-master/examples/images/truck10.png
caffe-master/examples/prediction_example/file_list.txt
caffe-master/examples/prediction_example/prediction_example.prototxt
caffe-master/tools/prediction_example.cpp
Step3:Compile Example.
We assume you are ine the caffe master directory, just use make to compile our example.
make
The caffe makefile will automatic find the new example and copy the result to build directory.
caffe-master ikki$ ls ./build/tools/prediction_example*
./build/tools/prediction_example
./build/tools/prediction_example.bin
./build/tools/prediction_example.o
./build/tools/prediction_example.o.warnings.txt
Step4:Prediction
Just run the example.
./build/tools/prediction_example
I0120 11:02:45.297869 2008834832 prediction_example.cpp:52] Result size: 3
I0120 11:02:45.297899 2008834832 prediction_example.cpp:55] Blob size: 0
I0120 11:02:45.297905 2008834832 prediction_example.cpp:58] -------------
I0120 11:02:45.297910 2008834832 prediction_example.cpp:59] prediction :
I0120 11:02:45.297919 2008834832 prediction_example.cpp:69] ------------------------------------------------------
I0120 11:02:45.297924 2008834832 prediction_example.cpp:73] Pattern:0 class:5 Prob=2.69744e-06
I0120 11:02:45.297940 2008834832 prediction_example.cpp:73] Pattern:1 class:3 Prob=4.0121e-05
I0120 11:02:45.297948 2008834832 prediction_example.cpp:73] Pattern:2 class:9 Prob=0.00531694
I0120 11:02:45.297956 2008834832 prediction_example.cpp:75] -------------
For run on GPU device.
./build/tools/prediction_example GPU 0
Here are the classes in the
CIFAR-10 dataset:
class:0 airplane
class:1 automobile
class:2 bird
class:3 cat
class:4 deer
class:5 dog
class:6 frog
class:7 horse
class:8 ship
class:9 truck
hi it worked pretty good with me can you tell a little bit about the prediction_example.prototxt
ReplyDeletehow to get it for a another example letsay imagenet
this page explain the layers.
Deletehttp://caffe.berkeleyvision.org/tutorial/
I tried to compile with no luck, I'm not sure what is wrong?
ReplyDelete/bin/sh: 1: bc: not found
CXX tools/prediction_example.cpp
tools/prediction_example.cpp: In function ‘int main(int, char**)’:
tools/prediction_example.cpp:40:2: error: ‘set_phase’ is not a member of ‘caffe::Caffe’
Caffe::set_phase(Caffe::TEST);
^
tools/prediction_example.cpp:40:19: error: ‘TEST’ is not a member of ‘caffe::Caffe’
Caffe::set_phase(Caffe::TEST);
^
tools/prediction_example.cpp:44:76: error: no matching function for call to ‘caffe::Net::Net(const char [58])’
Net net("./examples/prediction_example/prediction_example.prototxt");
^
tools/prediction_example.cpp:44:76: note: candidates are:
In file included from ./include/caffe/blob.hpp:4:0,
from ./include/caffe/caffe.hpp:7,
from tools/prediction_example.cpp:8:
./include/caffe/net.hpp:259:27: note: caffe::Net::Net(const caffe::Net&) [with Dtype = float]
DISABLE_COPY_AND_ASSIGN(Net);
^
./include/caffe/common.hpp:32:3: note: in definition of macro ‘DISABLE_COPY_AND_ASSIGN’
classname(const classname&);\
^
./include/caffe/net.hpp:259:27: note: no known conversion for argument 1 from ‘const char [58]’ to ‘const caffe::Net&’
DISABLE_COPY_AND_ASSIGN(Net);
^
./include/caffe/common.hpp:32:3: note: in definition of macro ‘DISABLE_COPY_AND_ASSIGN’
classname(const classname&);\
^
In file included from ./include/caffe/caffe.hpp:12:0,
from tools/prediction_example.cpp:8:
./include/caffe/net.hpp:27:12: note: caffe::Net::Net(const string&, caffe::Phase) [with Dtype = float; std::string = std::basic_string]
explicit Net(const string& param_file, Phase phase);
^
./include/caffe/net.hpp:27:12: note: candidate expects 2 arguments, 1 provided
./include/caffe/net.hpp:26:12: note: caffe::Net::Net(const caffe::NetParameter&) [with Dtype = float]
explicit Net(const NetParameter& param);
^
./include/caffe/net.hpp:26:12: note: no known conversion for argument 1 from ‘const char [58]’ to ‘const caffe::NetParameter&’
make: *** [.build_release/tools/prediction_example.o] Error 1
Same thing for me... :(
DeleteSame here.
Delete"Caffe::set_phase(Caffe::TEST);" set_phase() is no longer member of Caffe. You have to specify TEST phase in Net constructor like this Net("... .prototxt", Caffe::TEST);
DeleteI had the same problem, but fixed it by:
ReplyDelete1. Commenting out Caffe::set_phase(Caffe::TEST); in line 40 of prediction_example.cpp
2. Adding the test phase argument to the creation of the net, so Net net("./examples/prediction_example/prediction_example.prototxt"); became et net("./examples/prediction_example/prediction_example.prototxt", caffe::test); in line 44.
The stated probabilities seem really small. Can anyone make sense of those? Is there a mising normalization somewhere?
This comment has been removed by the author.
ReplyDeleteHi,
ReplyDeleteI can't find the mean file at "./examples/cifar10/mean.binaryproto" in Git repo.
You need to first down and convert cifar10 dataset. Use the following command:
Delete./data/cifar10/get_cifar10.sh
./examples/cifar10/create_cifar10.sh
And then you will get the ./examples/cifar10/mean.binaryproto file
Please note that test phase argument is written with capital letters. So, replace "caffe::test" with "caffe::TEST"
ReplyDeletethere is no make file in downloaded folder, new to caffe, please help.
ReplyDeleteCan this adapt to HDF5 data type?
ReplyDeleteHow to do that in windows ?
ReplyDeleteWow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
ReplyDeleteblueprism training in chennai | blueprism training in bangalore | blueprism training in pune | blueprism online training
From your discussion I have understood that which will be better for me and which is easy to use. Really, I have liked your brilliant discussion. I will comThis is great helping material for every one visitor. You have done a great responsible person. i want to say thanks owner of this blog.
ReplyDeleteJava training in Tambaram | Java training in Velachery
Java training in Omr | Oracle training in Chennai
Outstanding blog post, I have marked your site so ideally I’ll see much more on this subject in the foreseeable future.
ReplyDeleteData Science training in kalyan nagar | Data Science training in OMR
Data Science training in chennai | Data science training in velachery
Data science training in tambaram | Data science training in jaya nagar
Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeletemachine learning training in chennai
best training insitute for machine learning
machine learning course in Chennai
c++ programming snippets to beginner programmers
ReplyDeletecplusplus sample programs | Quadratic Equation
ReplyDeleteTop engineering colleges in India
technical news
digital marketing course in bhopal
what is microwave engineering
how to crack filmora 9
what is pn junction
Hey, nice site you have here!We provide world-class Oracle certification and placement training course as i wondered Keep up the excellent work experience!Please visit Greens Technologies located at Chennai.thanks alot.
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
Great efforts put it to find the list of articles which is very useful to know, definitely will share the same to other forums. thank you sir.
ReplyDeletePython Training in Chennai | Certification | Online Training Course | Python Training in Bangalore | Certification | Online Training Course | Python Training in Hyderabad | Certification | Online Training Course | Python Training in Coimbatore | Certification | Online Training Course | Python Training in Online | Python Certification Training Course
Thanks for sharing a useful information.. we have learnt so much information from your blog.... oracle training in chennai
ReplyDeletevery nice post...!salesforce training in chennai
ReplyDeletesoftware testing training in chennai
robotic process automation rpa training in chennai
blockchain training in chennai
devops training in chennai
Infycle Technologies, the best software training institute in Chennai offers the best Oracle training in Chennai for students, freshers, and tech professionals. In addition to that, other in-demand courses such as Big Data, Java, Python, Power BI, Digital Marketing will be trained with 200% practical classes. Once the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7502633633 to get more info and a free demo. Best Oracle Training in Chennai | Infycle Technologies
ReplyDeleteRegardless of the security break detailed last year, you actually need to search for another VPN that can do precisely exact thing NordVPN does. NordVPN Crack
ReplyDeleteConnectify Hotspot Pro break is the most recent highlighted application that used to settle the things as indicated by your longing this is most recent form that works! Thums Up Connectify Hotspot Crack
ReplyDelete