GPU Support for cv2.dnn on jetson Nano


I’m experimenting with the script from this github repository and it works with only 1-3 fps.
I have read some forum posts saying that there is no GPU support for cv.dnn and (for example) also not for cap_cv2.VideoCapture(). In some different posts I’ve read that there ist a GPU support now.

Now I’m not really sure if there is a GPU support or not and what is the current state? If not, is there a a possibility to activate the GPU support?

Some information about my system:

  • Image: jetson-nano-4gb-jp441-sd-card-image
  • OpenCV 4.1.1
  • CUDA Version 10.2
  • Ubuntu 18.04 LTS

Best regards

Assuming you have installed OpenCV with CUDA support (the default version installed with JetPack does NOT support CUDA/GPU) you must uncomment the lines starting with “detector.setPreferable…” (lines 11 and 12 in the current commit of the script in order to enable GPU usage.

Try that and report back if fps increases, you should see 3x performance improvement.

Hi dkreutz,
thanks for your reply.

I have wrongly assumed that the default version of opencv does support CUDA/GPU. So I have to install opencv with CUDA support first.

Just to give it a try I uncommented
and run

Is the error you can see below an indication to the missing support?

nvidia@nvidia-desktop:~/Mailrocketsystems/AIComputerVision$ python3 
Traceback (most recent call last):
  File "", line 130, in <module>
  File "", line 81, in main
    person_detections = detector.forward()
cv2.error: OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/dnn/src/dnn.cpp:999: error: (-215:Assertion failed) haveInfEngine() in function 'wrapMat'

And one more question if you dont mind. Could it be that I must install intel’s open vino environment first? Please have a look to the answer I got here:

When the error message appeared after uncommenting then I suppose it is caused by missing CUDA support. (Sorry, I can’t verify this on my Nano right now).

For building/installing OpenCV with CUDA support I recommend to use this script by community member @mdegans.

Regarding OpenVINO - maybe this is a specific requirement for AIComputerVision - I don’t remember having used/installed it for my OpenCV-DNN experiments.

Thanks a lot for the answer and your recommendation! I will have a look at it.