Ask Your Question

Is it possible to use OpenCL with OpenCV and DNN/Tensorflow

asked 2018-06-21 07:38:35 -0500

paatz04 gravatar image

Is there a way to make use of OpenCL for improved performance when using the OpenCV.DNN ?


Best regards, Patric

edit retag flag offensive close merge delete


Here some performance measurements for opencv

holger gravatar imageholger ( 2018-06-26 07:25:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-06-26 04:48:59 -0500

holger gravatar image

updated 2018-06-26 06:17:40 -0500

Ok - first of all - open cl is transparent - if it is available, it will be used. Look here : "OpenCL accelerated branches transparently added to the original API functions and are used automatically when possible/sensible..." So open cl for dnn will be used if available.

On the other hand, cuda for dnn ist NOT supported.

My personal experience/impression is that evaluating model on cuda(with the native dnn it was trained on) is way more performant than evluating the model with open cv on top of open cl. But please measure by yourself!

edit flag offensive delete link more


Thank you for the great explanation holger! That makes sense. Do you know if this also applies to mobile/android?

paatz04 gravatar imagepaatz04 ( 2018-07-04 06:55:51 -0500 )edit

Not sure - i really want to encourage you to measure by yourself! Compile with open cl support and measure it. Assumptions are usually wrong - measure it!

holger gravatar imageholger ( 2018-07-04 07:18:32 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-21 07:38:35 -0500

Seen: 570 times

Last updated: Jun 26 '18