Not able to use openCL on Mac

asked 2019-12-19 12:30:13 -0600

dslove gravatar image

updated 2019-12-20 07:18:13 -0600

I am trying openCV+Yolo3. I am using Mac with this config:

  • MacBook Pro (Retina, 15-inch, Mid - 2015)
  • Graphics Intel Iris Pro 1536 MB
  • macOS Catalina version 10.15.2

I checked Apple website and it says this MacBook supports openCL 1.2: https://support.apple.com/en-ca/HT202823

My program uses opencv-contrib-python. And the code snippet is:

net = cv2.dnn.readNetFromDarknet(model_configuration, model_weights) net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV) net.setPreferableTarget(cv2.dnn.DNN_TARGET_OPENCL)

I also tried DNN_TARGET_OPENCL_FP16. BTW, I use the common pre-trained yolo3 cfg and weights and coco.names.

The problem is, my program cannot use GPU on my Mac. When I run a video through it, the inference time is 300+ ms per frame and from Activity Monitor I can see that the GPU usage is 0.0% while CPU is 70%+. I don't know why I can't use GPU via openGL on the Mac. Is there any trick I miss?

edit retag flag offensive close merge delete