OpenCV with CUDA in Python on Jetson

preview_player
Показать описание

NOTE: If you use the cp command to save your build products, make sure to keep the same time stamps. For example:

$ cp -r --preserve=timestamps build_opencv /path/to/destination

Remember that the make utility keeps a list of the timestamps to help determine if something needs to be rebuilt. By default, cp marks copied files with the current timestamp. That means that make will rebuild everything if the timestamps are not preserved.

This works for all models of NVIDIA Jetsons. The Jetson in the video is a NVIDIA Jetson Nano Developer Kit.

For a Jetson Nano, you will need to modify the build_open_cv script.
The Jetson Nano doesn't know about the 8.7 (Jetson Orin) architecture
-D CUDA_ARCH_BIN=5.3,6.2,7.2,8.7
changes to:
-D CUDA_ARCH_BIN=5.3,6.2,7.2

and change the CUDA version to match your machine. On the Jetson Nano, this is 8.2.
-D CUDNN_VERSION='8.0'
changes to:
-D CUDNN_VERSION='8.2'

As an Amazon Associate I earn from qualifying purchases.

Some of these links here are affiliate links. As an Amazon Associate I earn from qualifying purchases at no extra cost to you.
Рекомендации по теме
Комментарии
Автор

Very excelent, learned 10 things in 8 minutes without reading a mile of wiki kak. More.... MORE!

samham
Автор

I love the way you explain concepts great video to help me with my senior project!

viewer
Автор

Can i do all this steps inside the virtual environment that i installed in my usb ? Cause my card is usin eMMC and i am struggiling with empty space.

Автор

Thanks Jim, exactly when I need it. I am still not sure how to figure out how to speed up inference .4 seconds per frame however, my gpu's are maxed out only getting 1 or 2 fps. just using standard Tensor model but was trying to learn how to use a TensorRT model and train it.

sy
Автор

If you mean the version in the video, the opencv_zoo version has changed since OpenCV 4.5. You either need to upgrade to the current version of OpenCV, i have upgraded to 4.9.0, but now i am getting onxx error

siddharthrana
Автор

June 2024 and works on jetson nano 4GB. But I have a separate question, why is it that when running jtop on the Jetpack item it says Jetpack: Missing?

fabianpalacios
Автор

I am trying to install OpenCV 4.8.0 with Python3.8. Following your instruction, I was able to install OpenCV with CUDA enabled (confirmed in jtop). But in following your video from 4.:45, I got a problem in setting the python path for python 3.8.0. I executed "opencv_version -v" command. Then, it returns "Interpreter: /usr/bin/python3 (ver 3.8)
Libraries: NO
numpy: NO (Python3 wrappers can not be generated)
install path: -
"
What should I do? I ran python3 without a problem. But install path is missing as you can see here. Then, how should I export its path to let OpenCV know? I will greatly appreciate your help.

bora
Автор

I struggled with this, and wound up copying over the python files into the stock Python3 path. I prefer that to environmental variables, but not sure why... maybe just so every future process doesn't have some tiny table in its memory showing that I installed python files in a weird place. I hide my shame like a Boy named Sue.

louieearle
Автор

Hi, I’ve been getting 3 fps after installing cuda. Previously i had 13-15fps when running the demo.py file. Is there any reason and solution to this problem? Thank you!

nightlifezz
Автор

I had cuda with opencv 4.5.4 but the demo says that i need to upgrade to the latest opencv version. Do i have to rebuild the whole process (which took you 7 hours) again with 4.8.0?😢

sungminpark
Автор

It loaded up to 98% but then froze. The process took about 10 hours. Everything on the screen except the terminal turned black and white. What should I do?

buketkaya
Автор

Thank you so much for the nice tutorial.
I got into a problem during the build. It complained that my gcc vesion was 9 and stopped. Now, I fixed my gcc version to 8 and tried the build process again from the beginning. But it doesn't do that. In /tmp/build_opencv, there are two directories, opencv and opencv_contrib. But jtop shows that opencv version remained the same 4.1 with CUDA no. Any suggestions?

bora
Автор

Hey Jim, great tutorial, I got it to build on Orin Nx 16gb took 1hr50. I went to try the opencv zoo demos and it looks like it's been updated to 4.9 about a week ago. I can't see the 4.8 version. Would you have a link to the 4.8 version? Thanks.

MICKEYESS
Автор

I have done all the steps but the system in jtop still shows me that the Opencv it is using is 4.5.1 with CUDA. When I use Python it tells me that it uses 4.9.0. How can I make the system tell me that it is using 4.9.0?

dimensionalrd
Автор

I have a problem. I have at jtop info tab, opencv: 4.10.0-dev with CUDA: YES and version 10.2.300 and cuDNN: 8.2.1.32 is displayed but when I execute "print(cv2.getBuildInformation())", it shows "version control: 4.10.0-dirty" and even worse, I can't find "NVIDIA CUDA: YES" or "cuDNN: YES " Can you please help?
Specs: jetson nano 4.6.5
ubuntu 18.04
python 3.8

AvinashKumarSingh-uf
Автор

Tengo error nvcc fatal : Unsupported gpu architecture 'compute_87'en Jetson Nano P3450 de 4gb
al intentar instalar OpenCV con CUDA en Python en Jetson Nano P3450 de 4gb

alexanderriosariz-xcbn
Автор

Hi thanks a lot for your video, when i did the last step to run the demo(on jetson tx2) i'm getting some error like "illegal instruction(core dumped)" . do you have any idea? I have the same version of opencv, python and jetpack.

paraskhosla
Автор

hi jim, do you know why it didnt work on my jetson? it freezed my jetson on 98% while building cuda on opencv

naufaltsanyqadamushidqi_
Автор

I'm using cuda 12.2, but for some reason it wants to use drivers from cuda 11.4. So I deleted cuda 10, 11, 12.0 and now I only have 12.2 with 12.2 drivers. I ran a code to check it, and it's still using 11.4 drivers even after deleting it.

Key_Capz_
Автор

How should I do it if I want to install in a virtual environment? Should I modify something in the sh file?

fabianpalacios
welcome to shbcf.ru