Quick and Easy OpenCV Python Installation with Cuda GPU in Under 10 Minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
tutorial in this video here we're going to build opensv with Nvidia cooler support so we can actually use the GPU together with opensv we're just going to skip the intern this video here we're just going to see how fast comments like build ohms V with GPU support again subscribe to the channel become a member for help with your project and so on but this just turns straight into installing and building ohmsv with kubra support so first of all here we need some different kind of tools so we need like Cuda you can just directly go into nvidia's website search for Cuda toolkit and then you can basically just go in here and download it for your computer the next thing here that we need is cmake so we're actually going to use cmake to build um our source files together with Coda support then you basically just go in here and choose the latest platform here download cmake then we're also going to install Anaconda I'm going to use Anaconda for my python so we're basically just going to use the python inside of anaconda and make sure to add it to your environmental variables in the path and then we can actually just use it later on we can also like a link to our binaries for SQL and so on but in this video we're going to mainly focus on Python and the next two things here is actually downloading from the GitHub repository of ohms V the the version of omcb that you want to build with your Cuda support so we both need to download like the original repository here opensv you need to go in here choose the version that you want so you can go inside the tags and choose whatever version here that you want to compile with open service or like GPU support and then the last thing here that we need is opencvcontrip so basically here when you want to download it you need to have the same versions of opensv then you can basically just go over here to to the right hit code and then you can basically just go in here and download as a zip folder or you can just clone it in your terminal if you prefer to do that but it is basically all we need here then we just need to go into CMAC and configure our opencv so here we're going to go into cmake again you need to create a new folder so I'll just go inside my folder here into my user directory so I'm just going to inside users and then we'll go inside my own user directory and we'll scroll down to the folder I have created for opencv with GPU so here we have osv GPU we have our ohms V here so we have unzip these files so we both have ohms V 4.5.2 and then we'll have click on trip module down here at the bottom then we just have a build folder here which should be empty so I'm just going to delete those so we can actually build it totally from scratch so here we can see that delete all these files so now we're deleting them now we have everything set up we can just go in here and browse our source I'm just going to delete my cache first of all then we need to end browse our souls we need to find ohmsv folder here so not the current trip but the opensv folder for our code and then we need to go in here where to build the binary so we actually want to build the binaries in our M2 build folder we're just going to choose this one here and select the folder so now we're going to hit configure here and then first of all we also need to download visual studio 2019 this doesn't work with the newest version of visual studio so make sure you have Visual Studio 2019 you can basically just go into the website Visual Studio code Visual Studio 2019 just going to Microsoft website here and download it so here you can basically just take the free download of the community version again don't take the 2022 here you can act like go down here at the bottom and find some some earlier versions so here we can see we have older downloads you can basically just go in here take 2019 and hit download so here let's go back again to our X like cmx setup so here we're just going to hit finish we can also like you have optional platforms here so I have XX 64 so I'm going to use that so that is the architecture of your CPU so here we're just going to hit finish and we'll start configuring our binaries for the first time and then we need to set some Flags here uh of what we actually want to use with our Cuda so now we're configure the files here for the first time then we need to set some different kind of flags so first of all we need to have with Cuda so we're just going to type in with here and then we go inside the width and then we scroll down to Cuda so we have to check this off because we want to build our binaries with Cuda support then we also have something called Fast Math that we need to enable so we can actually do fossil calculations on our GPU and then we have something called opensv world so we're going to use that as well I'm just going to find it so maybe we should type in World build ohmsv world we also need to do that so we have a world file linked to as well to our binaries and then we have something called extra and then we need to specify the path to our account trip module so here we have our contribute then we go inside the modules and then we just select this folder and now we have our extra modules path so that's basically like all we need to do first of all here and then we can hit configure one more time before we're going to do the last configurations and then we can generate our binaries that we can then build um so we can have opencv with GPU support so now where I configure this folder here once more so now we actually need to make sure that we act like doing this for python 3. so up here you can see that I have my Python 3 again we can see like the the path to an interpreter the library is also numpy and the installation path if you can't see this Python 3 here you're not able to actually do it for Python and you need to make sure that your ax like um you actually have the correct path to your python installation so if you go inside Python 3 here you need to make sure that all of these Anaconda python executables include and also the library files they are exactly like I have here if you don't have this one here it can act like be because of your numpy version so then you will go in and open an anaconda prompt and then you basically just type in PIP install and then you just type numpy Dash Dash and then you have upgrade and then you can basically just upgrade your numpy version to the latest and then you should actually just hit configure again and then you should actually get the Python 3 here where you can see your interpreter the library is numpy and so on and then you actually have ohms V build for python with GPU support so now we need to configure some more things here so first of all we have to enable the fast map I really need to search for Fast Math again so now we can see we have Cuda underscore fat matte we need to check that off as well and then we have something called Arc bin so we need to choose the architecture that we want to use I have two gpus so I'm going to use 6.1 and then and then I'm also going to use 8.6 basically you can just go into Wikipedia and find your version if you have like a GPU here with the DTX or RTX you can go in here and find the version so here we see we have the different kind of versions um over here to the right and then basically you just find your own GPU and you just specify that inside here in the arc bin so I'm using 6.1 and 8.6 so now I'm basically just going to take the last thing which is the configuration so here we can search for conf and here we want to delete the debug so we're only building this for release mode and then we have everything we can configure for last time before we hit generate and I can like build our binaries with ohms V with cooler support so now we're just going to hit configure so now we're configure the files here for the last time again we can still see our python we can even scroll up here we can see the Nvidia Cuda so we have the different kind of like versions we also have the toolkit Coda version that we just downloaded so we can both see the Nvidia Cuda and we should also be able to see our python free interpreter so now we can basically just hit generate here before we're going to build it with cmake and then we can just directly go in and use it with python so now our generation is done we can open up and then encounter prompt and then we're basically just going to to copy paste the command here that I'm going to throw in the description so we're just going to copy paste this one here and then we need to specify the path to our build folder so I have it inside my C directory and then I have it inside users and then I have inside my own directory here so this is my directory and then we had it inside omcv TPU and then we have this build folder here and then we need to have the target which we are going to install and then we're going to have our config here with release mode and then we can basically just hit enter here and it will build our binaries with GPU support so you can see it just runs through a lot of different kind of files so now it's actually like building the binaries with GPU support for ohmsv this should actually take like one one and a half hour maybe like two hours depending on your computer but again you will get a lot of errors or like warnings while it's actually like installing this opencvp report but usually just like skip those as long as it just succeeds in the end uh you should not worry about all the errors and warnings that you will get while it's installed in opencv so now we're done installing Opus V with GPU support so we can see that installation here is done you should actually get some errors while it's installing and building the binaries here from the source files but now you should if you see this output here you should be able to open up opens the weave with GPU support so now we're just going to open up a new Anaconda prompt to verify that this installation here actually works with opensv so first of all we're going to type in Python and then we're just going to import CV2 which is opencv and then here we can actually import like from CV2 so from CV2 we can import and then if we act like able to import Cuda we have actually verified that this installation here works so now I'm going to hit enter and now we can see that it just goes to the next line so we act like able to import coding then we can actually go inside coder then we can use cv2.coder or like just from crude because we imported Kubota so we can just Cuda dot print coda device info and then we can just take the served element it depends on like What indecker GPU is on and then we just hit enter and it should print the information here about the GPU that you have on a computer and and just verify that this act like works so here we can see I have an Nvidia GeForce RTX 3060 here then we can see some other different kind of like specs with the GPU clock speed amount of memory so like how much memory do we have on our dpu and so on so you'll get all the information here but now when you get it up this output and you're able to actually like import codep from CB2 then we can actually verified that this installation worked and you can now use opencv in Python with GPU support you can actually link to these libraries here or like these modules as well in C plus if you want to use that instead of python so thank you guys watching this video here and again remember to subscribe button and Bell notification under the video so in this video here I just try to do like this installation here of ohmsv with GPU support as fast as possible so I'll see in the next video guys bye for now
Info
Channel: Nicolai Nielsen
Views: 26,500
Rating: undefined out of 5
Keywords: opencv c++, opencv python, python opencv, opencv gpu, opencv gpu c++, opencv gpu python, gpu opencv, opencv cuda, opencv cuda c++, cuda gpu c++, opencv source code, build opencv source files, cmake configuration, cmake opencv, cmake opencv c++, cmake opencv gpu, opencv, NVIDIA, NVIDIA Cuda, NVIDIA cuDNN, The Coding Library, opencv nvidia, cuda opencv, cuda c++, cuDNN, install opencv, python, build opencv, build opencv python, install opencv python, cuda opencv python
Id: d8Jx6zO1yw0
Channel Id: undefined
Length: 10min 40sec (640 seconds)
Published: Mon Sep 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.