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

Python or C predict scripts? #74

Open
lucasjinreal opened this issue Jan 13, 2018 · 16 comments
Open

Python or C predict scripts? #74

lucasjinreal opened this issue Jan 13, 2018 · 16 comments

Comments

@lucasjinreal
Copy link

Hi, is there python or C scripts available?

@ThienAnh
Copy link

With python, you can using this script
demo.zip

@mkarki2
Copy link

mkarki2 commented Jan 23, 2018

Thanks @ThienAnh. That was helpful.

@yaoxinthu
Copy link

@ThienAnh
Thanks for your code. But there is a problem.

python demo.py
Traceback (most recent call last):
File "demo.py", line 17, in
import caffe
File "../python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "../python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: libmatio.so.2: cannot open shared object file: No such file or directory
gzyaoxin@edt-machine02-machine:~/ImageProject/PSPNET-cudnn5/evaluation$ python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import caffe


there are a ImportError about libmatio.so.2 in your code. I have already installed matio and import caffe succesfully when i do not modify sys.path.

But it seems to be a little different between the caffe in this project and official version. So using official version directly cause a other error.

How to solve this problem?

@ThienAnh
Copy link

See your issue in
#14

@yaoxinthu
Copy link

@ThienAnh
Thank you very much!

@ThienAnh
Copy link

@YaoXinatTHU you are wellcome

@pewpewpeww
Copy link

pewpewpeww commented Aug 27, 2018

@ThienAnh Hi ThienAnh, do you happen to have the prediction code for c ?? :-) Will appreciate your response. Thank you so much!!

Anyone who has a copy of a c prediction code can also response by helping me.

@ThienAnh
Copy link

@pewpewpeww I will share c code tonight. (Now i had out of office)

@ThienAnh
Copy link

@pewpewpeww This is code predict sample in c

PredictSample.zip

@pewpewpeww
Copy link

pewpewpeww commented Aug 28, 2018 via email

@lucasjinreal
Copy link
Author

@ThienAnh How the C inference speed on CPU?

@ThienAnh
Copy link

@pewpewpeww Utility.h only common funtions for read image, convert string2char. You can ignore it.

@jinfagang I don't test on CPU. (So i think it is very low)

@cobbwho
Copy link

cobbwho commented Mar 21, 2019

@ThienAnh Thank you so much. The code predict sample in c works. When i use the function called "predict" , I got a error "Check failed: error == cudaSuccess (2 vs. 0) out of memory" .I know it means my gpu memory may be small (about 11GB) . So i was thinking is there some key words like "batch_size" which i could modified. By the way , I use test prototxt file "pspnet101_cityscapes_713.prototxt" ,but there isn't "batch_size" or something like that .Do you have any idea? Any way , thank you ,thank you,thank you .
Hi, I solve this problem by modified input size from 713 to 463 and some kernel and strides.
And i got another problem,. when i predict an image ,i got a result without anything just white. Do you have any idea?

@ThienAnh
Copy link

ThienAnh commented Mar 21, 2019

@cobbwho default of batch_size is 1. Because if batch_size>1 --> Will be out of memory.
An idea for memory, you can split network to 2 or 3 or more parts, but performace will be slow

@cobbwho
Copy link

cobbwho commented Mar 22, 2019

@jinfagang I test a image about 473*473. GPU version use about 0.4s . CPU version use about 6.5s. It's too slow.

@cobbwho
Copy link

cobbwho commented Mar 23, 2019

@ThienAnh thank you .emmmm,I'm so sorry that the problem about "out of memory" I mentioned is a mistake . "batch_size" only happened in trainning progress., but the probleam hanppened in my prediction progress. I modified the input size from 713 to 473 ,and it's work. Any way ,thank you . I noticed another issue#75 about the predict result is wrong result . I have the same problem as you. I read the prediction code you uploaded called "PredictSample.zip" and I think It's right ,but the result is wrong too. At least the result is correct before forward delivery. But after a forward pass, the output data is 0 in output_layer. Seriously, I don't know why. Did you get the right result now?

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

6 participants