Тёмный
No video :(

Build OpenCV with CUDA Support for Jetson 

JetsonHacks
Подписаться 36 тыс.
Просмотров 31 тыс.
50% 1

Here are updated instructions for building OpenCV with CUDA for NVIDIA Jetson. Here we use a quite wonderful script from Michael de Gans, one of the experts in the Jetson community. The Github repository is here: github.com/mde...
If you are trying to use the new version with Python, here's some helpful hints: • OpenCV with CUDA in Py...
This build supports all of the Jetsons, including Orin and Nano.
In the video we go over how to set OpenCV settings specifically for CUDA and Jetson, and look at the documentation on how to support other OpenCV features. Plus a fun demo at the end!
For the demo, make sure that you pick the version of OpenCV Zoo to match the version of OpenCV you build!
Website: jetsonhacks.com
Github: github.com/jet...
Twitter: / jetsonhacks
Some of these links here are affiliate links. As an Amazon Associate I earn from qualifying purchases at no extra cost to you.

Опубликовано:

 

16 мар 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 190   
@eabybabu8199
@eabybabu8199 Год назад
Hi, Your channel is an exceptional resource for anyone interested in Jetson platform. The contents are well-presented, concise, and easy to follow, making it an excellent resource for beginners and experts alike. Your channel is an excellent resource for researchers like myself. Overall, I highly recommend this channel to anyone interested in Jetson platform. The content is high-quality, informative, making it an excellent resource for anyone looking to improve their skills in this area.
@JetsonHacks
@JetsonHacks Год назад
Wow, thank you very much for the kind words. I appreciate you taking the time to write them. Thanks for watching!
@markusbuchholz3518
@markusbuchholz3518 Год назад
It is a great pleasure and distinction to be a subscriber of your great channel. I am here probably from the beginning, You are always so consistent and precise. Your content is grateful and sufficiently helps to manage the highly library-dependent SW stack up on the Jetson boards. Great, you discuss often and deeply investigate the latest "technology" from the industry. I wish you good luck. Have a nice day.
@JetsonHacks
@JetsonHacks Год назад
Wow, thank you. And thank you for watching!
Год назад
Jim's dedication and knowledge in the space is unquestionable. We've used his tutorials many times over before for past development projects.
@JetsonHacks
@JetsonHacks Год назад
@ Thank you for the overly kind words! And, as always, thanks for watching!
@paulmcwhorter
@paulmcwhorter Год назад
This is really amazing. For so long I have wanted to know how to do this. Thanks for posting.
@JetsonHacks
@JetsonHacks Год назад
Thank you for the kind words, I am glad you found the video useful. I enjoyed your video on the new Jetson Orin Nano. East Africa looks like quite a beautiful place. Thanks for watching!
@paulmcwhorter
@paulmcwhorter Год назад
@@JetsonHacks Thanks for the kind words, and honored you watched the program. Hey, I tried this on the Orin AGX running jetpack 5.1.1, and it seemed to build correctly, and shows openCV to be cuda enabled, but it kills the FPS on even a simple program that just grabs and shows a frame. Jtop shows all the work is being pushed onto one cpu. I did edit the file you showed to version 8.6. Did you try this on the Orin AGX?
@JetsonHacks
@JetsonHacks Год назад
@@paulmcwhorter I have not tried it on the AGX Orin specifically, but have tried it on the Orin Nano. Do you have a link to the code you have issue with? Unless you multi-threaded the code, I would expect that it would mostly run on one CPU. I don't believe that any of the core grab/display OpenCV calls are CUDA accelerated. It's a fairly small subset that actually are CUDA enabled.
@paulmcwhorter
@paulmcwhorter Год назад
@@JetsonHacks It makes sense what you are saying. You tested or 'stressed' the system by calling the face recognition library On the Orin, I 'stressed' it by just feeding it a 1920x1080 camera feed at 60 fps, and the program was just simply opencv grabbing and displaying frames from the camera. I think I got about 25 fps. Your point is well taken, being cuda enabled still requires the programmer to be deliberate about utilizing the cuda. Again, always look forward to your videos.
@louieearle
@louieearle 11 месяцев назад
#TIL: Upgrading from the stock CUDA library broke a lot of stuff. I have an Orin AGX dev kit. The stock image had CUDA 11.4.315 on it, (jetpack 5.1.2). I manually updated it to CUDA 12.2. After doing that, I got all kinds of compilation errors, trying to build opencv 4.5.4 AND 4.8.0. There was no way to downgrade that I was able to find. I wound up flashing the system and starting fresh. At least my notes on how to set up a new system are getting better! Thanks for the awesome video!
@louieearle
@louieearle 11 месяцев назад
I didn't time how long it took to put OpenCV 4.5.4 on, but it took 25m 3.49s to download, compile, and install OpenCV 4.8.0. Confirmed with jtop that it has CUDA support!
@JetsonHacks
@JetsonHacks 11 месяцев назад
I'm not sure what you mean by compilation errors. Do you mean warnings? Were you unable to get it to compile? The interdependencies of the different subsystems are pretty strict. You have to really have a good reason to upgrade OpenCV. Probably the best way to use it is in a container for special applications, that way it doesn't effect the whole system. Thanks for watching!
@louieearle
@louieearle 11 месяцев назад
They were compilation errors, not warnings. They were mainly about templates needing to be statically cast when being assigned to literals. After the first 2, I reset my board with sdk manager.
@louieearle
@louieearle 11 месяцев назад
@@JetsonHacks I definitely had something borked with my dev tools. I had been manually updating libraries and tools to get some Shinobi plugins working, so the prob was definitely on my end.
@kelvinlee5934
@kelvinlee5934 Год назад
Thank you so much. Great work! Without you, I cannot go forward in Jetson Cuda
@JetsonHacks
@JetsonHacks Год назад
You are welcome, and thanks for watching!
@farrelfzeta6908
@farrelfzeta6908 9 месяцев назад
Thank you! Works flawlessly for version 4.8.1. Took around 3 hours to install on my Xavier NX Nvidia Dev Kit. However, I also installed ROS Noetic before thus also has a pre-installed opencv version 4.2.0 (no cuda) from ROS. I just need to point my python path to the opencv version 4.8.1 instead of 4.2.0 version.
@JetsonHacks
@JetsonHacks 9 месяцев назад
You are welcome. I am glad you found the video useful. Thanks for watching!
@Ivan-xg4ev
@Ivan-xg4ev Год назад
Thank you very much! I would recommend saving the build to another drive and copying it when you need to reinstall the operating system.
@JetsonHacks
@JetsonHacks Год назад
That's certainly a very good idea! Thanks for watching!
@pieroteran8626
@pieroteran8626 Год назад
Awesome, thanks! Worked for Jetson AGX Orin
@JetsonHacks
@JetsonHacks Год назад
You're welcome! Thanks for watching!
@MikePorterII
@MikePorterII Год назад
Super helpful! Short. Rational. To the point. Bless you!
@JetsonHacks
@JetsonHacks Год назад
I'm glad you found this useful. Bless you for watching!
@amirkhosravian1813
@amirkhosravian1813 Год назад
Great content as always. Descriptive, informative, helpful. Keep up the great content.
@JetsonHacks
@JetsonHacks Год назад
Wow, thank you for the kind words. And thanks for watching!
@viera1996
@viera1996 10 месяцев назад
Hi, I can't find the "build_opencv" folder in the "tmp" directory. I am using a Jetson Nano 4GB, and I followed your steps. Where can I find this folder?
@JetsonHacks
@JetsonHacks 9 месяцев назад
The folder is in /tmp after the build. /tmp is a temporary directory, and may be erased if you reboot the machine.
@auroram7797
@auroram7797 11 месяцев назад
It works for me on my Jetson Orin, save my day, Thanks!!!
@JetsonHacks
@JetsonHacks 11 месяцев назад
Great to hear! Thanks for watching!
@stevephillips5392
@stevephillips5392 7 месяцев назад
Thanks for the great video tutorial on installing OpenCV with CUDA support. I was able to successfully install OpenCV 4.5.4 on my Jetson Nano, with only the CUDA Arch BIN modules for 5.3 architecture. But testing didn't go well. You mention that I should ensure I download the correct version of OpenCV_Zoo for testing, but I only see one repository. When I try to run the demo.py from that one I am getting --> AttributeError: module 'cv2.dnn. has no attribute 'DNN_BACKEND_TIMVX'. It looks like this version wanted to run on OpenCV 4.8.0, so it may just be the wrong version of OpenCV_Zoo, but I don't see where to get any other one. Thoughts?
@JetsonHacks
@JetsonHacks 7 месяцев назад
It's never easy, is it? It looks like a poor job on the repositories part of matching up releases with the OpenCV release schedule. I would recommend that you do a git checkout on the commit closest to the 4.5.4 release date. The GitHub website has a commit browser, currently it says '130 Commits' on the last commit header. OpenCV 4.5.4 was officially released Oct 9, 2021. There looks to be a commit to opencv_zoo which is Jetson Nano related on October 31 (Add hardware GPU CUDA: Jetson Nano. commit hash: 6a77fd). You do the git clone, and then git checkout: $ git checkout 6a77fd6eebf821ff5cf1eb92d09e9f2d896cc8ed The short hash should work too. Then recompile. It's difficult to determine when any given feature stops working in the older OpenCV releases, so unfortunately it may take a lot of trial and error to find the features you want. Thanks for watching!
@0merr768
@0merr768 26 дней назад
Hello. I installed opencv 4.7.0 version on jetson nano with cuda. When I check in jtop, I can see that it says "opencv:4.7.0 with CUDA:YES". When I check it with python codes and terminl commands, I see CUDA is usable. However, when I want to detect objects with the yolov4-tiny model, I get an average of 2 fps. What's the problem? Can you help?
@JetsonHacks
@JetsonHacks 26 дней назад
I don't know the answer. CUDA enabled code must be called. It sounds like your code does not call it. You should ask on the official NVIDIA forums or YOLO forums.
@nurakhyarnordin3985
@nurakhyarnordin3985 6 месяцев назад
Hi... i'm using Jetson Nano with Jetpack 4.6.1, Python 3.6.9 and OpenCV 4.1.1 pre-loaded. When i use jtop to view CuDNN, it seem like my CuDNN is 8.2. The problem is why my build is getting failed using the mdegans script? Is it anything wrong i did?
@JetsonHacks
@JetsonHacks 6 месяцев назад
From your description it is difficult to tell why the build fails. You will need to set the CUDNN version to the one on your machine. Good luck on your project!
@owepofjienoqpithfvn
@owepofjienoqpithfvn 2 месяца назад
I wonder it works the same with jetson orin nano I've done installing opencv 4.10 for it but when I tried to do the demo in -bt 1 mode it keeps changing to cpu mode.....
@JetsonHacks
@JetsonHacks 2 месяца назад
I don't know what -bt mode is. Did you try it with -b=5 -t=7 like in the demo?
@kunalvalunj6194
@kunalvalunj6194 Год назад
Hello there are some issue with my system after installation there is one file should be present inside tmp which build opencv .but in my its not there, any solution?
@JetsonHacks
@JetsonHacks Год назад
Which file is missing?
@Digtal101
@Digtal101 Год назад
How where you able to screen record this footage with such a high frame rate? I'm currently using VNC to remote into my Jetson Nano, but I have a massive amount of lag by just navigating the desktop alone. The framerate while using VNC is worse if I run a simple script/code to check if my RPI V2 cameras are functional
@JetsonHacks
@JetsonHacks Год назад
It's a trick. I use an external recorder, the Black Magic Design ATEM Mini Pro: amzn.to/3M1tP1t A lot of people bought HDMI -> USB digitizers during the shutdown. That way you can record video to another machine easily. Thanks for watching!
@toad_day
@toad_day Год назад
Hi! Thanks for video. I used your repo to build opencv 4.6.0 on my jetson nano. It worker fine but it turned out that new version installed for python2 only and python3 still uses 4.1.1 version. The olny thing I changed in file were CUDA_ARCH_BIN and CUDNN_VERSION. What did i do wrong? Thank you.
@JetsonHacks
@JetsonHacks Год назад
It could be that another package over wrote your Python 3 bindings.
@HaiOuzan
@HaiOuzan Год назад
Hey, I want to install it on my jetson nano too. which parameters do you give to CUDA_ARCH_BIN and CUDNN_VERSION?
@JetsonHacks
@JetsonHacks Год назад
@@HaiOuzan Hey, you look up the parameters. They are available for your particular installation if you use jtop: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2cc6Irm0WuA.html and look in the INFO tab. Good luck on your build!
@user-tj7hx6ps9s
@user-tj7hx6ps9s 9 месяцев назад
Hello, I want to run OpenCV compiled with CUDA on Jetson TX2. What should I do? can you help me?
@JetsonHacks
@JetsonHacks 9 месяцев назад
Not sure what you are asking. You can follow this video, or this one: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BCNnqTFi-Gs.html
@buhush5832
@buhush5832 Год назад
I love watching your videos, they are so informational and compact, im a recent engineer graduate in IoT, and my graduation project was using Jetson nano for occupancy analytics, i have been thinking how can i use this for my advantage while looking for a job and can i start a business using jetson cards for security ? thank you for the videos and have a nice day.
@JetsonHacks
@JetsonHacks Год назад
Thank you for the kind words. RU-vid comments are not a good place for speculating about your business plans. Find someone in real life who can help advise you. Good luck on your career, and thanks for watching!
@user-wu1tm9md2k
@user-wu1tm9md2k Год назад
Does this make any difference if I am on Arch Bin 8.7? Just following the video, this might be answered later.
@user-wu1tm9md2k
@user-wu1tm9md2k Год назад
answered but I do get The following packages have unmet dependencies: libgtk-3-dev : Depends: gir1.2-gtk-3.0 (= 3.24.18-1ubuntu1) but 3.24.20-0ubuntu1.1 is to be installed Depends: libatk-bridge2.0-dev but it is not going to be installed Depends: libgtk-3-0 (= 3.24.18-1ubuntu1) but 3.24.20-0ubuntu1.1 is to be installed Downgraded these and everything worked fine. Thank you for the awesome content and thank you Michael de Gans!!
@JetsonHacks
@JetsonHacks Год назад
Depends on the algorithm of course :) An algorithm such as a DNN inference benefits greatly. 8.7 has between 6-12 CPU cores and between 1024-2096 CUDA cores. Typically one would expect a several time speed up in a proper CUDA algorithm part. Your bottleneck then tends to be how fast you can move the result to the desired place, and how you use the results. In the demo, the face detection is fast but the bottleneck is how long it takes to compose and display the resulting frame. The face detection itself is faster than can be displayed. Typically in a real application you would do the frame processing on a separate thread/processor, and then have the results displayed from a different processor. Many times you discard extra processed frames if you're using it for display purposes. However you may find that you need all the frames if you are doing algorithmic processing. It's the usual comment. If you need more speed, typically you have to do more work. Premature optimization has killed many projects. Thanks for watching!
@fablapp
@fablapp Год назад
HI Jim, txs for this excellent update of your previous video on the topic.... a couple of clarification if possible: you mention 4.5.4 release but at the beginning of the script it is stated 4.4... how and why did you pick that release?
@JetsonHacks
@JetsonHacks Год назад
OpenCV 4.5.4 is the default release for the version of JetPack on the machine. You can install the jetson-stats package to run jtop to list all of the JetPack library versions on the machine, such as cuDNN. Here's the video on how to install jtop : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2cc6Irm0WuA.html
@fablapp
@fablapp Год назад
@@JetsonHacks Hi, it worked great, thank you.... but still unsure.... so you recommend to install the same version of the default one? I am working on nano with Jetpacl 2.6.1 (recently updated) and the default openCV version in this release is 4.1.1. Should I then prefer the same version. Txs again for your time!
@JetsonHacks
@JetsonHacks Год назад
@@fablapp I'm glad you got it to work. You should choose the OpenCV version which fits your needs. I usually use the version from the Jetson release for the demonstration, but you can use whichever one your project needs. Good luck on your project!
@josecas9099
@josecas9099 Год назад
hello, thank you for your videos, i liked and subscribed! Is there a reason why one would want to install other NVIDIA GPU architectures on one device? for example i have a jetson orin nano developer kit, would i even be able to use other architectures on this device? thank you for your time
@JetsonHacks
@JetsonHacks Год назад
You are welcome, thank you for subscribing! It really helps the channel. There are several different Jetson device architectures. Jetson TX1/Nano, TX2, Xavier and Orin. If you only are planning on using one of the architectures/Jetsons ever, having the others doesn't provide any advantage. However, many people have a Jetson Nano or another generation. The incremental cost of compiling for all of the architectures versus compiling a version for each one is an easy tradeoff to make if you plan on doing it infrequently. Just compile it once, and it runs on all the Jetsons. If you are doing this pro, it makes sense to only compile it for the GPU architecture you are using. You will need to the the architecture number for the device you plan to use, delete the rest. It takes less time, and is smaller in size. The advantage of including all the architectures is that you don't have to know anything about that. Thanks for watching!
@viorelnegoita
@viorelnegoita 11 месяцев назад
Another excellent video. Could you please share how did you update the Python version? is this a Jetson Nano, or an Jenson Orin Nano? what Jetpack version are you using? Thanks!
@JetsonHacks
@JetsonHacks 11 месяцев назад
Thank you for the kind words. This is shown on a Jetson Xavier NX running JetPack 5.1. If you have a Jetson Nano, there are ways to upgrade the Python version. A couple of newer revisions are in the Ubuntu repository. You can also use this method: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-LSdXakt8nZ8.htmlsi=C9T35mabeE_C6nD9 Thanks for watching!
@luriic_2636
@luriic_2636 2 месяца назад
thank you! Thanks to this, CUDA works perfectly. But since installing CUDA, I have a problem with my RAM increasing more and more. For example, it increases by 0.1G every 2 hours. There is an issue where jetson xaiver quits when all memory is used. Do you know the solution?
@JetsonHacks
@JetsonHacks 2 месяца назад
Sounds like you have a memory leak somewhere. It's hard to tell what the problem is until you analyze which program(s) are causing the problem. Thanks for watching!
@RatedA4Aliens
@RatedA4Aliens 8 месяцев назад
Question, after you build openCV and new libraries/headers are put in standard ppaces, what happens with previous so/h files? I noticed the old version came from a debian package called libopencv-dev version 4.1.1-2 and they are still lingering around Do you remove this package so the compiler doesnt link with them?😊
@JetsonHacks
@JetsonHacks 8 месяцев назад
The Debian packages go to /usr/lib while the newly built files end in /usr/local/lib (and equivalent bin directories). Here's a description: wp.me/p7ZgI9-3Ne Typically you would point your PATH and/or PYTHONPATH to look at your new install first. Some people get rid of the old version. Typically I keep both as other parts of the system may rely on the default version. Thanks for watching!
@RatedA4Aliens
@RatedA4Aliens 8 месяцев назад
@@JetsonHacks Thank you, that should work out assuming hierarchy of the paths in LD_LIBRARY_PATH is set correctly
@JetsonHacks
@JetsonHacks 8 месяцев назад
@@RatedA4Aliens Yes, it works. I think some people get little lost when they're trying to integrate it into their environment when they don't have much experience with development. It's not intuitive and feels a little hidden. However, it's how development has been done for decades.
@jardelvieira8742
@jardelvieira8742 10 месяцев назад
I followed all your steps with my Jetson Nano 4GB to build OpenCV 4.8.0. I checked in Jtop, and it was recognizing "OpenCV: 4.8.0 with CUDA: YES." However, when I executed "print(cv2.getBuildInformation())", it showed OpenCV 4.1.1:General configuration for OpenCV 4.1.1 | Version control: 4.1.1-2-gd5a58aa75. What is the problrm?
@user-iz7hg1iu9s
@user-iz7hg1iu9s 10 месяцев назад
I have similar problem. I followed this video and at jtop info tab, opencv: 4.5.4 with CUDA: YES is displayed but when I execute "print(cv2.getBuildInformation())", it shows "version control: 4.8.4-dirty" and even worse, I can't find "NVIDIA CUDA: YES" or "cuDNN: YES " .... Can somebody help?
@JetsonHacks
@JetsonHacks 9 месяцев назад
Looky here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BCNnqTFi-Gs.html
@igreque8996
@igreque8996 7 месяцев назад
Thank you for that. I am trying to run a custom model and torch.cuda.is_available() always returns false, any idea on how to compile pytorch with cuda support please ? Thanks
@JetsonHacks
@JetsonHacks 7 месяцев назад
I haven't worked with this. Please ask your question on the official NVIDIA Jetson forums. Thanks for watching!
@ANGELCORRALESCUEVAS
@ANGELCORRALESCUEVAS 6 месяцев назад
Thank you very much for your video! I've followed it perfectly and I'm getting everything right in jtop as well as when checking importing cv in python. I'm making a custom library to use in the gstreamer plugin nvivafilter to do image remapping operations and undo distortion using cv::cuda::GpuMat and cv::cuda::remap among others. The problem is that when running my gstreamer pipeline: terminate called after throwing an instance of 'cv::Exception'. what(): OpenCV(4.5.4) /home/ubuntu/build_opencv/opencv/opencv/modules/core/include/opencv2/core/private.cuda.hpp:106: error: (-216:No CUDA support) The library is compiled without CUDA support in function 'throw_no_cuda'. Do you know what could be the cause? I would appreciate any help on the subject!
@JetsonHacks
@JetsonHacks 6 месяцев назад
Hard to say, you should ask on the NVIDIA forums. I would think that GStreamer would need to be linked against the modified OpenCV library, but that's just a guess. Thanks for watching!
@omersar6853
@omersar6853 26 дней назад
Hı I have jetson orin nano and ı try to use csı camera named ımx219 but when I run opencv code it doesn't work. Then I checked GStreamer enable status on opencv it tell me GStreamer=NO how can I fix that problem.
@omersar6853
@omersar6853 26 дней назад
import cv2 # GStreamer pipeline string for capturing from IMX219 camera on Jetson Nano pipeline = "nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=1280, height=720, format=NV12, framerate=21/1 ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink" # Open the capture pipeline cam = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER) if not cam.isOpened(): print("Cannot open camera") exit() while True: ret, frame = cam.read() if not ret: print("Failed to grab frame") break cv2.imshow('Frame', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break # Release the camera and close OpenCV windows cam.release() cv2.destroyAllWindows() here my code when I run it get me cannot open camera
@JetsonHacks
@JetsonHacks 26 дней назад
I do not understand the question. Is this with the OpenCV library you built following the instructions in the video?
@omersar6853
@omersar6853 26 дней назад
@@JetsonHacks my english is so bad but now I figured problem out by watching this video Thanks :)
@JetsonHacks
@JetsonHacks 25 дней назад
@@omersar6853 I am glad you got it to work!
@josevitormonteiro39
@josevitormonteiro39 Год назад
Cannot run the opencv zoo model with 4.5.4 version installed... the notebook requires the 4.7, should I try upgrading?
@JetsonHacks
@JetsonHacks Год назад
I don't know which notebook to which you are referring. If you have a requirement for 4.7, you should use 4.7. Thanks for watching!
@a.b.c4812
@a.b.c4812 10 дней назад
how did you set deafualt python ans python 3.8
@JetsonHacks
@JetsonHacks 9 дней назад
I believe that it's the default for the version of L4T that I was using that day.
@KILL3RYT
@KILL3RYT 11 месяцев назад
Hy, actually I'm using orin nano 8gb. I have an issue building Opencv. I want to change cap_v4l.cpp inside opencv/modules/videoio/src in line 1001 in 4.5.4 version. The select () timeout warning is the one i need to change. I used tv.tv_sec = 0 so that select() won't wait for anything. But after i build it, in /tmp/Opencv i see it is not taking any changes that was made during build time. It is using default things itself. I'm actually downloading opencv and opencv-contrib and then making the changes and updating the path inside build_opencv. sh in ---- git clone line. Please help me 🙏
@JetsonHacks
@JetsonHacks 11 месяцев назад
I'm not sure what the issue might be. Did the file actually compile?
@KILL3RYT
@KILL3RYT 11 месяцев назад
​@@JetsonHackshy, actually I have solved myself. So the issue was with git clone. Whatever you make changes inside opencv file, when you use git clone , I don't how, it clones the default opencv contents only. Rather cloning the changed opencv contents. So that was the issue..so initially I thought the changes made in opencv files are applied. But actually it was not. So later I placed the changed opencv folders directly in /tmp/build_opencv and then made changes inside build_opencv. sh and recompiled. Now it's taking my changes 😅
@ryandewsnap2671
@ryandewsnap2671 Год назад
I upgraded OpenCV on python3 to 4.5.4 and left python2 on 4.1.1. I understand I could have used my default OpenCV installation but wanted to match yours for the sake of the tutorial. Before I was getting stuck around 20% but I'm now a couple hours in around 50% so I have confidence it will work or at least successfully compile (Jetson Nano 4gb). When I use JTOP, I still see OpenCV 4.1.1 even after upgrading to 4.5.4. Do you know how to direct JTOP to python3 or could there be a different reason for showing the wrong version? Regardless, I appreciate the video. I targeted python3 and OpenCV 4.5.4 in the script, so I am hopeful I will be in good shape so long as I use python3. EDIT: After the compilation was completed, the version in JTOP updated and says CUDA is enabled. However when I run cv2.getBuildInformation() with python3 I get the same as before building, I do not see CUDA/CUDNN references.
@JetsonHacks
@JetsonHacks Год назад
Python3 refers to the location of the package in the Python environment you are using. You can check the current Python environment: import sys print(sys.executable) print(sys.path) In the output of sys.path, the site-packages directory is typically one of the paths. That's where Python looks for installed packages when you use an import statement. If you have multiple versions of OpenCV on your system, you will need to adjust the Python path to point to the version you are trying to use as the first entry. Thanks for watching!
@jardelvieira8742
@jardelvieira8742 9 месяцев назад
@ryandewsnap2671 Did you manage to solve the problem?
@jakekisiel7399
@jakekisiel7399 Год назад
CUDA is so CUTE ahhhh 😊
@JetsonHacks
@JetsonHacks Год назад
Thanks for watching!
@erichganz4605
@erichganz4605 Год назад
Thanks so much!! How should I proceed if I wish to install openCV with cuda a virtual environment? Any ideas?
@JetsonHacks
@JetsonHacks Год назад
How is it any different than what you would normally do?
@chaddwick25
@chaddwick25 9 месяцев назад
I tried building the same Opencv with cuda support for Ubuntu 18.04. The cmake would always state that Cuda was enabled but when I started up my conda env Cuda support was never enabled. I am gonna give this method a try later.
@JetsonHacks
@JetsonHacks 9 месяцев назад
You have to set your PYTHONPATH so that Python knows where the new library is located so it can use it, otherwise it will default to the old one. See: wp.me/p7ZgI9-3Ne and ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BCNnqTFi-Gs.html Thanks for watching!
@figuera_m
@figuera_m Год назад
First of all, thank you so much for the video, I have a jetson xavier nx (P3518) and i just follow exactly the same procedure and the end it didn't work, neither in jtop or with cv2.getBuildInfomation() i get something about CUDA. Help 😢
@JetsonHacks
@JetsonHacks Год назад
First, did you open a new Terminal before running jtop or Python? The Terminal needs to be updated. The installation should be in /usr/local/bin. Try: $ cd /usr/local/bin $ opencv_version build You should see the version that you built.
@aitorjara100
@aitorjara100 Год назад
Hello ! Thank you for this tutorial ! I have one question: since I often work with different projects I like to work with archiconda/miniconda virtual environments to try different installations with many dependencies. Is it possible to install opencv this way by activating first a virtual environment? I want to have opencv with CUDA enabled within a specific environment and then install other libraries such as tensorflow, numpy, etc, untill all works together finely. Does this work this way or is it supposed to install everything on the system?
@JetsonHacks
@JetsonHacks Год назад
Python virtual environments control Python modules. OpenCV is a C/C++ based library which is installed as a system library on the machine. There are ways to do what you describe, but they are not Python virtual environments. Docker is one such example. Thanks for watching!
@danielsd4277
@danielsd4277 Год назад
Hi If I check Jtop my opencv version is 4.1.1 I am using an nvdia xavier nx. I ran the the script but used version 4.1.1 for some reason CUDA is not installed when I check jtop. Any idead what I did wrong? Thanks for the great videos!
@danielsd4277
@danielsd4277 Год назад
At 29% building my nvdia jetson reboots for some reason
@JetsonHacks
@JetsonHacks Год назад
You are welcome for the videos. The default build for this script is 4.4.0. Unless you set the version to be 4.1.1, more than likely the build did not complete. You can check the build log for details as to what might be the issue. You don't state which Jetson you have, so it is difficult to give more advice. Thanks for watching!
@vuxuanhai7311
@vuxuanhai7311 11 месяцев назад
Thank you so much for your knowledge. Could you make a video to build YOLOv3 on Orin running with C script? Iam struggle with library dependency on that.
@JetsonHacks
@JetsonHacks 11 месяцев назад
I don't have any experience with YOLOv3, so I don't think I would be able to shed much light on the subject. Thanks for watching!
@vuxuanhai7311
@vuxuanhai7311 11 месяцев назад
@@JetsonHacks TYSM
@hiteshdev6944
@hiteshdev6944 Год назад
Hi Do you know how to erase emmc data from the jetson nano emmc module?
@JetsonHacks
@JetsonHacks Год назад
Yes. If you want to reset the eMMC, you will need to flash it. You can use the SDK manager from a host x86 to reflash. Thanks for watching!
@hasithasenevirathne3360
@hasithasenevirathne3360 Год назад
OpenCV gets installed to Python 2.7 but I cannot use it from Python 3.8 version. What am I doing wrong?
@JetsonHacks
@JetsonHacks Год назад
Which Jetson and which version of L4T are you using?
@Joy-ec5fl
@Joy-ec5fl Год назад
Hi, Thanks for the resource! I have one question, my jetson xavier nx builds openCV successfully, but it's weird that I can not find any build_opencv file in /tmp/ when I search in my jetson xavier. But if I check the build infromation with python3, it shows that build_opencv file exists in /tmp/.
@JetsonHacks
@JetsonHacks Год назад
How do you check for its existence in Python?
@Joy-ec5fl
@Joy-ec5fl Год назад
the same method in your video ,first "import cv2" and then "print(cv2.getBuildInfromation())"
@Joy-ec5fl
@Joy-ec5fl Год назад
​@@JetsonHacks I found the reason! I deleted the "build file" after build, thanks for sharing!
@JetsonHacks
@JetsonHacks Год назад
@@Joy-ec5fl I'm glad you found the reason.
@jardelvieira8742
@jardelvieira8742 10 месяцев назад
@@Joy-ec5fl Have you rebuilt OpenCV
@erichganz4605
@erichganz4605 Год назад
@JetsonHacks Thank you! We all know that jetson devices have so-called unified memory. I am wondering how this concept translates into the Open CV framework with cuda support. One of the main functions in open cv with cuda is gpu_frame = cv2.cuda_GpuMat() and gpu_frame.upload(frame). Am I duplicating here the array? Is there a way to let open cv/ cuda know, that the data is already available for the GPU? I know that for pycuda on jetson devices handles this automatically. However I was not able to find information on that for open cv with cuda.
@JetsonHacks
@JetsonHacks Год назад
I don't believe that OpenCV is written with the Jetson in mind. The OpenCV algorithms are a collection written by multiple authors. In most cases, the CUDA bindings are added later in the process. More than likely, these are written for desktop GPUs. Most of the OpenCV code is written in C/C++, with binding for Python later added. You will need to examine each algorithm you are using on a case by case basis. It may be worth asking this question on the Jetson forums, or in the OpenCV community. If you're looking for fast computer vision processing on the Jetson, consider using VPI which takes full advantage of the Jetson architecture. Thanks for watching!
@sy2532
@sy2532 10 месяцев назад
The cuda build worked on my new Orin Nano, JTOP is saying OpenCV 4.5.4 CUDA: YES ... now I need to learn how to enable cuda for opencv. do you have any recomindations, Jim?
@JetsonHacks
@JetsonHacks 10 месяцев назад
You have to write OpenCV code that utilizes CUDA/GPU functions. There is a group of OpenCV library functions that take advantage of CUDA, it's beyond what can be explained in a RU-vid comment on how to use them.
@sy2532
@sy2532 10 месяцев назад
@@JetsonHacks hey jim for some reason when I rebuilt OpenCV I got two different versions... JTOP shows the 4.5.4 version... but when I run python3 from my command prompt my application it says I am running 4.8.1 which has no CUDA built for it. How do I correct this? Can I rebuilt using 4.8.1? >>> import cv2 >>> print("OpenCV Version:", cv2.__version__) OpenCV Version: 4.8.1
@JetsonHacks
@JetsonHacks 9 месяцев назад
@@sy2532 You have to point the PYTHONPATH at where you installed the new OpenCV library: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BCNnqTFi-Gs.html
@nandeeshabs765
@nandeeshabs765 11 месяцев назад
Hi I am using ubuntu version 20.04 , iam running one opencv object detection application its taking load on cpu When I check the status using jtop its showing opencv with Cuda status is yes If I run Import cv2 Print(cv2.cuda.getCudadevicecount()) Its giving 0 as output Please suggest me how to solve this issue And run my application using gpu
@JetsonHacks
@JetsonHacks 11 месяцев назад
Look at the build information: import cv2 print(cv2.getBuildInformation()) and find out if CUDA is available.
@francojoem3114
@francojoem3114 Год назад
Hey sir, could you please share the modified YuNet code, interfaced for USB Camera?
@JetsonHacks
@JetsonHacks Год назад
Which part did you have trouble with?
@JariAho-kz8fh
@JariAho-kz8fh Год назад
Anyone knows if exists a "ready made - image file, with cuda support, for Jetson Nano 2gb " to download? - since on that device, compiling would take 8 - 12 hours. - rather, would like to download a all ready compiled image, "with all the bells and whistles"..
@JetsonHacks
@JetsonHacks Год назад
If you know how to read shell scripts, you can look at the scripts in github.com/dusty-nv/jetson-containers and modify them to install a prebuilt version of OpenCV 4.5. Thanks for watching!
@masseteilchen3000
@masseteilchen3000 Год назад
YES!
@JetsonHacks
@JetsonHacks Год назад
I agree whole heartedly. Thanks for watching!
@jimhouskeeper1441
@jimhouskeeper1441 Год назад
I was following your tutorial on how to build OpenCV with CUDA support. I am running on a Jetson Orin AGX. I followed your directions as closely as possible twice however I am getting the following errors while compiling cuda_compile_1_generated_gpu_mat.cu.o, it is complaining that in texture.hpp(61): error: texture is not a template typedef texture TexRef Because I am only planning to run on arch 8.6, I only added that arch to the cmake flag and selected cuDNN 8.6 Any suggestions? Thanks! Jim
@JetsonHacks
@JetsonHacks Год назад
Which version of OpenCV are you using? The arch of Orin is 8.7, not 8.6
@jimhouskeeper1441
@jimhouskeeper1441 Год назад
@@JetsonHacks sorry, that was a typo in my question. I did set the arch equal to 8.7, the cuDNN was 8.6. I was trying to build OpenCV 4.5.4. Trying to closely follow what you did. I thought about trying more recent, but figured sticking with what you were building made the most sense. I tried again, same failure.
@jimhouskeeper1441
@jimhouskeeper1441 Год назад
Maybe wrong Cuda library version. Nvcc - - version returns V12.2.91.
@JetsonHacks
@JetsonHacks Год назад
@@jimhouskeeper1441 Which JetPack/Jetson Linux version are you using? The latest nvcc here is 11.4.315
@jimhouskeeper1441
@jimhouskeeper1441 Год назад
@@JetsonHacks I think what got me into trouble is I tried to upgrade to the latest Jetpack. Now trying to figure out how to start fresh by factory resetting the Jetson, but it looks like I can't do that without SDK manager running on a host Linux PC, which I do not have convenient.
@nickbeser5187
@nickbeser5187 Год назад
Thank you for your video. I was able to build opencv 4.5.4 on my Jetson Orin Nano. When I tried to modify the face_detection_yunet code following your instructions I got the following error: cv2.error: OpenCV(4.8.0) /io/opencv/modules/dnn/src/onnx/onnx_importer.cpp:279: error: (-210:Unsupported format or combination of formats) Failed to parse ONNX model: face_detection_yunet_2023mar.onnx in function 'ONNXImporter' I;m not sure why this is occurring, but searching on the internet, suggests that this might be a path problem. Any ideas?
@JetsonHacks
@JetsonHacks Год назад
Hard to tell, but I'd be suspicious about the OpenCV(4.8.0) in the error you see.
@JetsonHacks
@JetsonHacks 9 месяцев назад
I forgot, you need to add git-lfs: $ sudo apt install git-lfs And then after switching to the opencv-zoo directory: $ git lfs install $ git lfs pull Otherwise the files are too large to pull from the git command line.
@muhammadwaqar4374
@muhammadwaqar4374 Год назад
I couldn't find "opencv_zoo" on your repos. Is it available???
@JetsonHacks
@JetsonHacks Год назад
Sorry for the late reply, this question was hidden from me for some reason. opencv_zoo is part of Opencv: github.com/opencv/opencv_zoo
@muhammadwaqar4374
@muhammadwaqar4374 Год назад
@@JetsonHacks thanks 👍
@DreamRobotics
@DreamRobotics 2 дня назад
You are my favorite.
@JetsonHacks
@JetsonHacks 2 дня назад
Thank you for the kind words, and thanks for watching!
@mertmiracark7848
@mertmiracark7848 Год назад
Hi, I have a nvidia jetson nano by your video im trying to build opencv cuda but when it comes to %24 i got an error which is Cmake error at cuda_compile_1_generated_cpu_mat.cu.o.RELEASE.cmake:221 , how can i fix that problem please help me
@JetsonHacks
@JetsonHacks Год назад
Hard to tell from your description which version of L4T you are running or what the error is that you encountered. Did you post the error on the Github repository associated with the scripts?
@mertmiracark7848
@mertmiracark7848 Год назад
​@@JetsonHacks i fixed that problem with arch-binary(or smth else i dont remember clearly) it was 7.2 but for jetson nano i need to do 5.3 so i did it but when all stuffs done in jtop opencv with cuda still no i looked github repo's issues part but i cant see anything for my question. Did i do something wrong? Also in terminal last lines for installation doesnt seem look likes in video.
@JetsonHacks
@JetsonHacks Год назад
@@mertmiracark7848 Did you restart jtop? 5.3 is included in the script for the GPU architecture. Did you look at the build information in Python? What version of OpenCV did you build?
@mertmiracark7848
@mertmiracark7848 Год назад
@@JetsonHacks i built 4.5.4 like u did in video and i restart my jetson nano. I am newbie and im using something like this for the first time so if i cant explain my problem so properly im sorry.
@JetsonHacks
@JetsonHacks Год назад
@@mertmiracark7848 I am unable to tell if you got it to compile correctly. I am unable to tell what the results of your Python print(cv2.getBuildInformation()) test were.
@collinb5524
@collinb5524 Год назад
Great stuff!
@JetsonHacks
@JetsonHacks Год назад
Thank you for the kind words, and thanks for watching!
@FedericoMorenoCh
@FedericoMorenoCh 11 месяцев назад
Great content!!
@JetsonHacks
@JetsonHacks 11 месяцев назад
Thank you for the kind words. Thanks for watching!
@bxoz3352
@bxoz3352 Год назад
hello i followed everything it worked i installed opencv 4.1.1 it shows cuda support but its only when i use python not python3 what is the solution plz
@JetsonHacks
@JetsonHacks Год назад
My guess is that you need to modify your PYTHON PATH to include the directory where the new modules is stored. Thanks for watching!
@bxoz3352
@bxoz3352 Год назад
@@JetsonHacks Thank you for your response but can you guide me on how to do this?
@jardelvieira8742
@jardelvieira8742 9 месяцев назад
@bxoz3352 Did you manage to solve the problem?
@bxoz3352
@bxoz3352 9 месяцев назад
@@jardelvieira8742 sadly no And im so disappointed in the jetson itself since it doesnt run yolo with good fps too its too slow
@xentilzaxable
@xentilzaxable 8 месяцев назад
Any body compile opencv with libnvjpeg? I try accelerate decode jpeg decompression use nvjpeg on jetson nano.
@JetsonHacks
@JetsonHacks 8 месяцев назад
I am unsure what this means. Do you mean substitute one of the libraries that OpenCV compiles against?
@xentilzaxable
@xentilzaxable 8 месяцев назад
@@JetsonHacks Jetson nano has two libraries for working with jpeg: 1) libjpeg is the standard library that opencv is usually built from; 2) libnvjpeg is a library from nvidia that supports hardware acceleration when decoding jpeg. I built opencv with libnvjpeg. But when trying to read a jpg file with the cv::imread function, the program crashes. Gdb has shown that a drop in the lbnvjpeg library is occurring. Perhaps you know how to achieve hardware acceleration for jpeg decoding using the usual functions like imread imdecode?
@JetsonHacks
@JetsonHacks 8 месяцев назад
@@xentilzaxable That's an interesting approach. I haven't tried it. However, it's worth asking the question on the official NVIDIA Jetson forums, maybe others have done this.
@xentilzaxable
@xentilzaxable 8 месяцев назад
​@@JetsonHacks I ask on the NVIDIA forum, Nvidia replies: opencv is not supported, but I can ask the opencv community. I didn't find a solution in Google, but I saw many people trying to do the same thing.
@JetsonHacks
@JetsonHacks 8 месяцев назад
@@xentilzaxable That's unfortunate, maybe a developer will answer at some point. I don't know a good solution to your issue, but it sounds like a worth while project for you. Good luck!
@m.g.sathiyanarayanan4527
@m.g.sathiyanarayanan4527 Год назад
Hi, My Nvidia jetson nx developer kit specifications are: platform: machine: aarch64 system: Linux Distribution: Ubuntu 18.04 Bionic Beaver Release:4.9.299-tegra python:3.6.9 Libraries CUDA: 10.2.300 cuDNN:8.2.1.32 TensorRT:8.2.1.8 VPI:1.2.3 vulkan:1.2.70 opencv:4.7.0-dev-with CUDA: NO Hardware: Model:NVIDIA JETSON XAVIER NX DEVELOPER KIT SoCL:tegra194 CUDA ARCH BIN: 7.2 L4T:32.7.3 jetpack:4.6.3 I followed the above tutorial and checked the jtop the cuda is still NO How to make it yes
@JetsonHacks
@JetsonHacks Год назад
Did you compile open CV with version 4.7.0-dev ? My initial guess would be that something over wrote your installation if that is not the case. Also, make sure to restart jtop so it can read the new library.
@siddharthrana512
@siddharthrana512 6 месяцев назад
Hi i have used all your steps , and i am able to successful build opencv , but when i am doing python3 , import cv2 , it saying that (tf2) dhanvi@ubuntu:~$ python3 Python 3.8.18 (default, Sep 11 2023, 13:19:25) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'cv2'
@JetsonHacks
@JetsonHacks 6 месяцев назад
It's hard to tell how you set up your environment variables to support your new version from your explanation. You may find this helpful: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BCNnqTFi-Gs.html Thanks for watching!
@deplorablesecuritydevices
@deplorablesecuritydevices Месяц назад
Before anyone else wastes their time this does not work on jetson orin nano
@JetsonHacks
@JetsonHacks Месяц назад
Not sure what you mean by "does not work". I've built it on the JON and did not have any issues.
@deplorablesecuritydevices
@deplorablesecuritydevices Месяц назад
@@JetsonHacks I went through all of the steps and I see what you see when I look at Jtop but when I enter the magic numbers to tell the python script to run with cuda I get the error "setUpNet DNN module was not built with CUDA backend switching to CPU"
@JetsonHacks
@JetsonHacks Месяц назад
@@deplorablesecuritydevices If you are running it in Python, did you set up the PYTHONPATH and install it correctly? You should be following this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BCNnqTFi-Gs.htmlsi=D13iYiv9CEvki7ne
@deplorablesecuritydevices
@deplorablesecuritydevices Месяц назад
@@JetsonHacks That didn't fix it but it seems to be related to this path variable. Also thank you for the help and thank you for the funny videos. I was grumpy until I saw the "wtf" clip in the middle of the link you shared.
@JetsonHacks
@JetsonHacks Месяц назад
@@deplorablesecuritydevices Thank you for the kind words, and I hope you can trick it into working. I know that's it's not as straightforward a task as one might think.
@jardelvieira8742
@jardelvieira8742 11 месяцев назад
I attempted to install OpenCV 4.5.0, jetpack 4.6 and 7GB swap on my Jetson Nano 4GB and received this error message: [ 26%] Building nvcc fatal : Unsupported gpu architecture 'compute_87' CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.RELEASE.cmake:221 (message): Error generating /tmp/build_opencv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o modules/core/CMakeFiles/opencv_core.dir/build.make:63: recipe for target 'modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o' failed make[2]: *** [modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1 CMakeFiles/Makefile2:2981: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 Makefile:162: recipe for target 'all' failed make: *** [all] Error 2 Do you wish to remove temporary build files in /tmp/build_opencv ? (Doing so may make running tests on the build later impossible) Y/N y rm: cannot remove '/tmp/build_opencv/opencv/build/CMakeFiles/Progress/23': Permission denied
@JetsonHacks
@JetsonHacks 11 месяцев назад
Did you try removing the 87 architecture from the script?
@jardelvieira8742
@jardelvieira8742 11 месяцев назад
@@JetsonHacks I haven't tried. Why should I do that, and how can I do it?
@JetsonHacks
@JetsonHacks 11 месяцев назад
@@jardelvieira8742 Modify the build script build_opencv.sh
@Peter-bp4pj
@Peter-bp4pj Год назад
Great videos and content, thank you :) I have an issue using the Orin Nano dev kit. I've followed the steps, modified mdegans script to only build for arch_bin 8.7 with CUDNN version 8.6, as I understand is correct for 4.5.4 (took about 55 mins). The symptom I have is the same as @nickbeser5187.... error: OpenCV(4.8.0) /io/opencv/modules/dnn/src/onnx/onnx_importer.cpp:279: error: (-210:Unsupported format or combination of formats) Failed to parse I've worked my way through the script and don't see anything wrong, any thoughts?
@JetsonHacks
@JetsonHacks Год назад
error: OpenCV(4.8.0) would lead me to believe that you are not using the version that you built.
@JetsonHacks
@JetsonHacks 9 месяцев назад
You need to add git-lfs: $ sudo apt install git-lfs And then after switching to the opencv-zoo directory: $ git lfs install $ git lfs pull Otherwise the files are too large to pull from the git command line.
Далее
OpenCV with CUDA in Python on Jetson
8:38
Просмотров 13 тыс.
USB Cameras - NVIDIA Jetson
23:54
Просмотров 26 тыс.
女孩妒忌小丑女? #小丑#shorts
00:34
Просмотров 21 млн
Why Everyone Is OBSESSED With Arc Browser
10:26
Просмотров 272 тыс.
NVIDIA Jetson AGX Orin Unbox, Setup, Demo - Just Wow
13:24
Adding Network Connectivity to the Jetson Nano
7:11
Просмотров 18 тыс.
I forced EVERYONE to use Linux
22:59
Просмотров 367 тыс.
OPENCV 4 + CUDA on Jetson Nano
13:28
Просмотров 65 тыс.
The cloud is over-engineered and overpriced (no music)
14:39