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 person_tracking.py script in order to enable GPU usage.
Try that and report back if fps increases, you should see 3x performance improvement.
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 detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
and run person_tracking.py
Is the error you can see below an indication to the missing support?
nvidia@nvidia-desktop:~/Mailrocketsystems/AIComputerVision$ python3 person_tracking.py
Traceback (most recent call last):
File "person_tracking.py", line 130, in <module>
main()
File "person_tracking.py", 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.