Ask Your Question
4

How can Caffe be interfaced using OpenCV

asked 2015-10-05 12:40:19 -0600

215 gravatar image

Hi guys.. I kinda new to the deep learning stuff so I hope you can help me a bit.

I installed Caffe, and trained a classifier (mnist example) which is capable of detecting digits.

The classifier is of filetype .caffemodel, and was wondering if it possible to it with OpenCV to test its performance example in realtime.

I tried googling everywhere, and don't seem to be able to find one example which loads and simple image, apply the classifier on to it, and thereby determine whether or not the image contains the object which the classifier contains.

Is that a too hard task, or should one be able to apply the classifier which Caffe has modeled?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
5

answered 2015-10-05 21:44:26 -0600

berak gravatar image

updated 2015-10-07 04:40:54 -0600

There is a new dnn module in opencv3/contrib, that allows you to load pretrained caffe or torch models, and do a prediction in opencv

edit flag offensive delete link more

Comments

2

You got it correct, so take the credit for it ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2015-10-07 04:41:08 -0600 )edit
1

yea, right, thanks. i was actually hoping, that more folks had tried it, and would have first hand experience !

berak gravatar imageberak ( 2015-10-07 07:04:33 -0600 )edit

Please update the link

eshirima gravatar imageeshirima ( 2017-06-27 15:48:13 -0600 )edit

@eshirima its not that difficult: https://github.com/opencv/opencv/tree... . Since the comment in 2015, the module was moved to the main OpenCV branch!

StevenPuttemans gravatar imageStevenPuttemans ( 2017-07-12 09:13:47 -0600 )edit
1

@StevenPuttemans I know it seemed like a rather stupid comment but I had no knowledge of the move. I tried digging for it in contrib. I appreciate the response

eshirima gravatar imageeshirima ( 2017-07-12 10:00:59 -0600 )edit
2

answered 2015-10-07 08:01:51 -0600

dtmoodie gravatar image

updated 2015-10-07 08:03:13 -0600

If you want to use the version of caffe that you built, you can use something like this to interface it with your code: https://github.com/dtmoodie/EagleEye/... Mainly look at the wrapInput() for wrapping a cv::cuda::GpuMat into a caffe::blob, and doProcess for actually processing an image with caffe.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-05 12:40:19 -0600

Seen: 5,080 times

Last updated: Oct 07 '15