Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to run OpenCV DNN ON GPU ANDROID

Hello everybody, I recently tested my pre trained MobileNet on my android machine by using dnn module in c++. It seems my code is only computing on CPU. I used OPENCV ANDROID v.3.4.6 and I tried to set:

cv::ocl::setUseOpenCL(true);
cv::setNumThreads(2);
net.setPreferableBackend(DNN_TARGET_OPENCL);
net.setPreferableTarget(DNN_TARGET_OPENCL);
setUseOptimized(true);

but seems that the app run on the CPU with only 3,92 FPS @1024x768 My GPU is a ARM Mali-G71 MP2.

Perhaps Opencv Android 3.4.6 hasn't OPENCL enabled? I've read that, in some cases, I have to rebuild OPENCV with -DWITH-OPENCL = YES option is this the case? I so set my image in a UMat variable, but nothing changes.

Where I'm wrong ? Thank you for your help. Francesco

How to run OpenCV DNN ON GPU ANDROID

Hello everybody, I recently tested my pre trained MobileNet on my android machine by using dnn module in c++. It seems my code is only computing on CPU. I used OPENCV ANDROID v.3.4.6 and 4 and I tried to set:

cv::ocl::setUseOpenCL(true);
cv::setNumThreads(2);
net.setPreferableBackend(DNN_TARGET_OPENCL);
net.setPreferableTarget(DNN_TARGET_OPENCL);
setUseOptimized(true);

but seems that the app run on the CPU with only 3,92 FPS @1024x768 My GPU is a ARM Mali-G71 MP2.

Perhaps Opencv OpenCV is not the best way to run a DNN on a Android 3.4.6 hasn't OPENCL enabled? I've read that, in some cases, I have to rebuild OPENCV with -DWITH-OPENCL = YES option is this the case? I so set my image in a UMat variable, but nothing changes.GPU? Where I'm wrong ?

Where I'm wrong ? Thank you for your help. Francesco