► *My Other Tutorials:* YOLOv4 On Android Using TFLite ua-cam.com/video/YzAjAS6Os8c/v-deo.html Custom YOLOv4 Object Detection with TensorFlow and TFLite ua-cam.com/video/vzTCJM18uoM/v-deo.html Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet) ua-cam.com/video/-NEB5P-SLi0/v-deo.html Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset) ua-cam.com/video/sKDysNtnhJ4/v-deo.html YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT ua-cam.com/video/tCmC7nyfJp8/v-deo.html Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams ua-cam.com/video/FE2GBeKuqpc/v-deo.html Real Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux ua-cam.com/video/FjyF03uawsA/v-deo.html Build and Install OpenCV 4.4.0 with CUDA (GPU) Support on Windows 10 ua-cam.com/video/tjXkW0-4gME/v-deo.html Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6 ua-cam.com/video/PlW9zAg4cx8/v-deo.html Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows ua-cam.com/video/GagII5PAeKg/v-deo.html
well explained bro.... but i'm getting an error while configure CMake Error at CMakeLists.txt:107 (enable_language): No CMAKE_C_COMPILER could be found. can you help me?
Thank you, but after following the steps you provide i am getting this error: Traceback (most recent call last): File "", line 1, in File "C:\Users\leonr\Anaconda3\lib\site-packages\cv2\__init__.py", line 102, in bootstrap() File "C:\Users\leonr\Anaconda3\lib\site-packages\cv2\__init__.py", line 90, in bootstrap import cv2 ImportError: DLL load failed while importing cv2: The specified module could not be found.
THANK YOU SO MUCH DUDE!!! You really made my day. Now I can use my gpu for testing some scripts with yolo in almost real time. You are the best. Thank you for making a second chance videos for us the non-lucky ones lol. You really deserve your likes
Everything was executed well. But when I ran the test script file I got more speed when using the CPU. Here is the output. CUDA --- 1.0304639339447021 seconds --- CPU --- 0.9209995269775391 seconds --- My PC Specs are CPU - AMD Ryzen 9 5900x and GPU - 3080 Vision.
I had a problem installing opencv due to the location I chose to install opencv from. I chose to leave it at downloads which was a mistake. To avoid similar problem, follow the video and install it from C drive.
😎 THAAANK you so much! I just spent two weeks trying to get various configurations for environments to run on Ubuntu without success. Your videos worked without too many issues back on Windows. Though I had to build Darknet based on what "The AI Guy" instructed. Working Specs: Windows 10 GTX 1070 GPU Driver: 456.71 CUDA: 11.0.194 cuDNN: v8.0.5.39 NSight: 2020.3.2 OpenCV + contrib: 4.5.1 cMake: 3.20.1 Anaconda 3: 2020.11 Visual Studio Community 2019 PS: If you want to see GPU/CUDA utilization in the task manager you can change the graphs with their drop-down menus in their top left corners.
dude, i did everything, i successfully switched to gpu, but anaconda prompt does not work, only IDE works. thank you so much for everything you are my hero :D
Thank you so much!! It worked. And initially, I used native Python. It threw an error saying "Couldn't find some dll" so I switched to Anaconda and it worked! May be path issues I guess. But it worked. Thanks again!
the installation worked in the base environment perfectly, but when I tried it in the virtual environment when I entered "import cv2" I get the following message: "ImportError: OpenCV loader: missing configuration file: ['config-3.8.py', 'config-3.py']. Check OpenCV installation." -- how do I fix this?
Hey TheCodingBug, nice to meet you! I just found your channel and subscribed, love what you're doing! I like how clear and detailed your explanations are as well as the depth of knowledge you have surrounding the topic! Since I run a tech education channel as well, I love to see fellow Content Creators sharing, educating, and inspiring a large global audience. I wish you the best of luck on your UA-cam Journey, can't wait to see you succeed! Your content really stands out and you've put so much thought into your videos! Cheers, take care, and keep up the great work!
I followed the instructions as the video, but python3 kept appearing as unavailable. So I uninstalled anaconda and installed it again, but this time selecting the advanced option "Add Anaconda3 to my PATH environment variable". Then I followed the rest of the video and now it is working perfectly.
Great tutorial! But, I want to fill the gap that you missed on 8:55. Before you upgrade numpy, you should install the numpy first at the environment, after that, you can upgrade it. I missed that part, which confusing me little bit at first, because no numpy at my environment. Anyway, I subs you tho!
i had an error when i tried to configured in cmake. The eroor is "error in configuration process, project file may be invalid" what should ı do? i installed visual studio a while ago. So i dont knowif I had press the c++ part. is it because of that? I looked up and ı installed visual studio 2019 in my D server. İs it a problem? because cmake is in my C: server.
If you've got error like this "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include\crt/host_config.h(143): fatal error C1189: @/error: -- unsupported Microsoft Visual Studio version! Only the versions between 2013 and 2017 (inclusive) are supported!" ,go to Program Files -NVDIA GPU Computing Toolkit CUDA -version -include and crt folder. In host_config.h file change line 141 #if _MSC_VER < 1700 || _MSC_VER >= 2000 instead of #if _MSC_VER < 1700 || _MSC_VER >= 1920.
If anyone has problems at 4:25, where you have numpy 1.19.2 and still the message "Unavailable: java python2 python3" appears, install numpy 1.19.2 through pip ( pip install numpy==1.19.2 ) instad of conda. At least it worked for me. Also, upgrading/just installing numpy will upgrade/install to 1.20.1, which is not compatible I wasted a few hours figuring this out
You must have had previous installations as from a fresh Win10 installation this tutorial doesnt work. DLLs are missing. For example when installing Anaconda you need to add it to the path for those api dlls.
Hi, I get this error although I try to do exactly as you do: CMake Error at modules/dnn/CMakeLists.txt:39 (message): DNN: CUDA backend requires cuDNN. Please resolve dependency or disable OPENCV_DNN_CUDA=OFF Call Stack (most recent call first): modules/world/CMakeLists.txt:13 (include) modules/world/CMakeLists.txt:32 (include_one_module)
For those who have not found python 3 even after updating numpy I found same error but it was due to my anaconda path was not set in system environment variables when I did that it installed properly and opencv was build properly without any error
@@kristelquezon4624 I did everything as mentioned in the video but build for python was still unavailable so when I completed the whole process i found that in the end the python folder would be missing which would contain the main file
Then after that I tried to recheck what was missing and I found that my anaconda path was not there in system environment variable so when I added that the error disappeared you can just search environment variable in your windows search bar you will find two things i found two things environment variable for lenevo(I have legion 5 pro) and below was system variable try to add your required python path to 'system' variable
helping others out. don't use the console command he gives. (if it's not populating the install folder) instead do this in the build folder (assuming the install folder should be in the build folder) cmake --build . --config Release cmake --install . --config Release
Hi, I need help... Its really emergency CMake Error at cuda_compile_1_generated_gpu_mat.cu.obj.Release.cmake:220 (message): Error generating C:/OpenCV_Build/build/modules/world/CMakeFiles/cuda_compile_1.dir/__/core/src/cuda/Release/cuda_compile_1_generated _gpu_mat.cu.obj I'm getting this error when I run this command: "C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build" --target INSTALL --config Release
@TheCodingBug had to use cuda 11.2 due to rtx 3070 showing some warnings with DLL when installing. Eventually got to the point where I import cv2 in gpu environment still says no module named cv2 followed all steps with clean plate and apart from warning in cmake about wrong version of python that asked me to add something to path file there were no other problems. Any idea how to solve it? PS. import cv2 in python does work without gpu ve
Everything worked and installed perfectly in my vir env but when I try your test_script.py it returns following error: (C:\Users\Dell\MyEnv) C:\Users\Dell> python test_script.py Traceback (most recent call last): File "test_script.py", line 13, in cuMat1.upload(npMat1) cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-i1s8y2i1\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' also when I try cv2.cuda.getCudaEnabledDeviceCount() it returns 0
Hi, you are my last hope, I am using OpenCV 4.4.0 with numpy 1.20.0, trying to bind tensorflow version 2.4.0 and it gives me an error (NotImplementedError: Cannot convert a symbolic Tensor (random_zoom/zoom_matrix/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported), but it also works fine on numpy version 1.19.2, but from this version CV2 crashes with an error (RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd). Please tell me what could be the problem? python 3.8.5
I am getting this error in cmake : CMake Error at modules/dnn/CMakeLists.txt:45 (message): DNN: CUDA backend requires cuDNN. Please resolve dependency or disable OPENCV_DNN_CUDA=OFF Call Stack (most recent call first): modules/world/CMakeLists.txt:13 (include) modules/world/CMakeLists.txt:32 (include_one_module) CUDA is installed CUDNN is installed and added to enviroment variables nvcc --version is working
In my case, all going smoothly but the cmkae cmd stop at this "opencv_test_core SSE4_2.vcxproj -> C:\FILES\OPENCV_BUILD\Build\modules\world\opencv_test_core SSE4_2.dir\Release\ope ncv_test_core_SSE4_2.lib" and no other explanation, just stop at that. In a video the command prompt say "installing" when done but mine different. Anyonw how to solve it? Thank you
i have entered this code to cmd "C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build" --target INSTALL --config Release. But i got error. Because Cmake want to create a file in Windows apps folder. But this folder is read-only and i cant change it. I checked everything i did. Can you help me?
First of all nice tutorial. Was frusturated for 3 days. The only problem was when I tried the test_script.py on my RTX3060 notebook CPU time was lesser than CUDA
when i install opencv in virtual environment it shows error "C:\openCV_build\opencv-4.5.1\modules\python\src2\cv2.cpp(33,10): fatal error C1083: Cannot open include file: 'numpy/nd arrayobject.h': No such file or directory [C:\openCV_build\build\modules\python3\opencv_python3.vcxproj]" what should i do.
hi, when I tried installing opencv using cmake, I get an error saying "error in configuration process, project files may be invalid". How to fix this please help.
how do i include the paths needed in my project on pyinstaller? i always get these errors after the .exe has been built regarding the opencv; " File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module File "cv2\__init__.py", line 102, in File "cv2\__init__.py", line 62, in bootstrap File "cv2\__init__.py", line 60, in load_first_config ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation." how do i fix these?
If you have module not found error, you may need to launch python from anaconda terminal using "python" instead of the shortened "py". I had it installed properly, but spent forever trying to fix it because of this stupid thing. Apparently py does not launch the anaconda activated or anaconda base environment, but launches some other version of python. Hope this helps someone else.
At the time of recording this tutorial, it worked on GTX1050 amd GTX1060. Not sure now after release of new versions of opencv, cuda, and visual studio.
My problem is when chosing cuda_arch. it dosen;t have any version to selecting. When I select the version fit to mine. it doesn't;t work. Error happened. How to solve?
By following this video also i was not able to do "import Cv".. .then i reinstalled Anaconda by choosing the Path to the environment variable and then finally i got " import Cv". currently i am using python 3.10.9..with this version i tried to create a Virtual environment.. but i am facing error here.. the error is like : (base) C:\Users\FHW>conda create -n opencv_gpu python-3.10 Collecting package metadata (current_repodata.json): done Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed. can you please help me with this ?
Worked perfectly. Please mention how long it takes to build as it took me more than an hour and I thought of stopping it in between, glad I didn't do it. Thanks
@@TheCodingBug I found the "problem" : you forgot to mention one cmake setting. I was building for ALL supported CUDA architectures instead of the latest (8.6). Changed that and now I compile in less than 30 minutes. Seems like you should mention it.
Hi, @TheCodingBug, I followed your all steps, but last command didn't generate cv2 library. and and during running, I found a warning message. "error C2065: 'DIFFERENT_SIZES_EXTRA' : undeclared identifier [C:\OpenCV_Build\build\modules\world\opencv_test_cudawarping.vcxproj]". Kindly resolve my issue.
I am trying to configure OpenCV 4.6 in the virtual environment. However, the program is unable to detect numpy even after running the --upgrade command of numpy to the latest version. I even checked whether numpy is installed in the virtual environment, even after numpy being installed, CMake is still not detecting the numpy version in the NUMPY_INCLUDE_DIRS section. After several attempts, I even manually copied the numpy's installed path in the virtual environment to the NUMPY_INCLUDE_DIRS slot to see atleast if that works. It still won't detect numpy's version. It still mentions python3 bindings unavailable. How to solve this? Your assistance on this would be greatly beneficial.
I followed the steps as mentioned in the tutorial. But opencv build was not available for python3 (3:40 in the tutorial). I deleted build and configured again and now opencv build is available for python3. Even I did not downgrade numpy as specified in the tutorial. Hope this helps for someone !!!
There are some functions in cv2 that can use GPU acceleration. You can see it in action in my other tutorial "Face Detection Using OpenCV with CUDA GPU Acceleration"
@@sebastianm3505 I had to reinstall Anaconda (and I chose to include the path during the installation, not sure if that was necessary). I had two versions of Anaconda installed somehow. I had upgraded Anaconda and it showed up twice in Windows Apps and Features so I uninstalled both and then reinstalled. Anyways, that worked for me. YMMV.
Bro I am getting this error " (-217:Gpu API call) cuDNN did not return a suitable algorithm for convolution. in function " Can you please help me with this .Please
Thanks for your help, but i still have a problem with openCV, it works fine, but when i try to execute my OpenCV project with pyinstaller or auto-py-to-exe Opencv is not imported and the executable file won't start. have any idea on how to fix this
hello great video !! , I have a question I followed every step but when I try to import in anaconda I get this error \anaconda3\lib\site-packages\cv2\__init__.py", line 109, in load_first_config raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames)) ImportError: OpenCV loader: missing configuration file: ['config-3.9.py', 'config-3.py']. Check OpenCV installation.
Hi, I was doing all steps in order and I did not receive any errors. However, in the final step, when I want to “import cv2”, I’ve got this error? “DLL load failed while importing cv2: The specified module could not be found” Do you have any idea how can I solve this problem? I had: Windows 10 Enterprise N LTSC GPU 980 GTX
Having Nvidia GeForce 1650, when I run a code before this, fps was 5-6 but after this it is still 8-9. In other words, it didn't increase as I expected. Is this normal?
Hello, good tutorial, but im unable to configure the opencv the second time with error error LNK2019: unresolved external symbol fseeko referenced in function main [C:\OpenCv_Build\build\CMakeFiles\CMakeTmp\cmTC_7a241.vcxproj], i follow the steps accordingly (except redownloading the vs 2019) any solutions? Thank you
It would be a good idea to do a video on steps to update opencv and tensorflow gpu versions. Always afraid I mess up something if I simply uninstall the previous version.
That's true. For tensorflow, it's really easy. Just see the supported cuda and cudnn versions against a particular tensorflow version and install them. Use Anaconda for that. For opencv, it becomes headache though.
Hey nice tutorial, i get it all right untill i get this error when running the test script : Traceback (most recent call last): File "test_script.py", line 13, in cuMat1.upload(npMat1) cv2.error: OpenCV(4.5.3) C:/OPEN_CV/opencv-4.5.3/opencv-4.5.3/modules/core/src/cuda/gpu_mat.cu:116: error: (-217:Gpu API call) initialization error in function '::DefaultAllocator::allocate' could anyone help please
Dear coding bug, while configuring the, I get a lot of SSL connect errors. Configuration completes but these errors are written while loading. Would this be a problem? I could not manage to do what you said. Could it be not happening because of these SSL connect errors I got?
Hİ TheCodingBug, First of all thanks for this nice video!! I am getting the following warning in the opencv_world folder when installing OpenCV on Windows 10. Do you have any information about what originated from? Is it important? warning : field of class type without a DLL int erface used in a class with a DLL interface
fatal error C1001:Internal error in the compiler. [C:\Build\modules\core\opencv_test_core_AVX512_SKX.vcxproj] I have this error every time I want to install openCV, do you know any solution? I follow the steps of other tutorials, but I got the same error.
I followed this tutorial and it recognizes my gpu and even run simple codes for gpu test. But when i run a code with cv2.dnn.DNN_BACKEND_CUDA and cv2.dnn.DNN_TARGET_CUDA nothing happens. It doesn't show any module missing or any error message, but the video where it should appear the detected objects crashes. The code isn't the problem because i tested it on google colab and works fine. Also it works fine when i let with cpu parameters. Could you tell me what do you think is may causing this problem? Thanks in advance for your attention !!
Hi, thanks for the detailed video. I followed the steps exactly as per the video (excluding the virtual environment part as I don't think I need?) but when I try and import cv2 as cv and copy your test script, calling cv.cuda_GpuMat() and other functions such as cv.imshow() and cv.imread(), pyCharm says it cannot find the reference and as such the library doesn't work. Do you know why this might be? Thanks!
Please help me, I have write same code in build using CMD like in the video (7:07) "C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build"--target INSTALL --config Release Error: C:/OpenCV_Build/build--target is not a directory and get error like this, what shoul i do?
@@TheCodingBug Thankyou sir! done, but. If I import cv2 by code in cmd, cv2 is detected. and if I run by IDLE python, cv2 still not detected. what should I do?
@@jonarad9955 it seems your IDE is using a virtual environment. You have to build for that environment as well or change IDE settings to use base Python environment. Also, make sure there are no multiple Python distributions installed (let's say Anaconda and native Python).
Is it also possible to perform all the setups for installing opencv with gpu support with both native installation of python and anaconda or we just need to keep Anaconda ?
► *My Other Tutorials:*
YOLOv4 On Android Using TFLite
ua-cam.com/video/YzAjAS6Os8c/v-deo.html
Custom YOLOv4 Object Detection with TensorFlow and TFLite
ua-cam.com/video/vzTCJM18uoM/v-deo.html
Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet)
ua-cam.com/video/-NEB5P-SLi0/v-deo.html
Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset)
ua-cam.com/video/sKDysNtnhJ4/v-deo.html
YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT
ua-cam.com/video/tCmC7nyfJp8/v-deo.html
Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams
ua-cam.com/video/FE2GBeKuqpc/v-deo.html
Real Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux
ua-cam.com/video/FjyF03uawsA/v-deo.html
Build and Install OpenCV 4.4.0 with CUDA (GPU) Support on Windows 10
ua-cam.com/video/tjXkW0-4gME/v-deo.html
Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6
ua-cam.com/video/PlW9zAg4cx8/v-deo.html
Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows
ua-cam.com/video/GagII5PAeKg/v-deo.html
well explained bro.... but i'm getting an error while configure
CMake Error at CMakeLists.txt:107 (enable_language):
No CMAKE_C_COMPILER could be found.
can you help me?
Thank you, but after following the steps you provide i am getting this error: Traceback (most recent call last):
File "", line 1, in
File "C:\Users\leonr\Anaconda3\lib\site-packages\cv2\__init__.py", line 102, in
bootstrap()
File "C:\Users\leonr\Anaconda3\lib\site-packages\cv2\__init__.py", line 90, in bootstrap
import cv2
ImportError: DLL load failed while importing cv2: The specified module could not be found.
THANK YOU SO MUCH DUDE!!! You really made my day. Now I can use my gpu for testing some scripts with yolo in almost real time. You are the best. Thank you for making a second chance videos for us the non-lucky ones lol. You really deserve your likes
Thank you for the appreciation. I am glad it was helpful to you.
This tutorial saves time and (more important) nerves! :) Big thanks for the effort! It took 50 mins on regular 7200rpm HDD
Everything was executed well. But when I ran the test script file I got more speed when using the CPU.
Here is the output.
CUDA --- 1.0304639339447021 seconds ---
CPU --- 0.9209995269775391 seconds ---
My PC Specs are CPU - AMD Ryzen 9 5900x and GPU - 3080 Vision.
It only works for Nvidia GPUs.
I don't understand why it is so complicated...
I had a problem installing opencv due to the location I chose to install opencv from. I chose to leave it at downloads which was a mistake. To avoid similar problem, follow the video and install it from C drive.
😎 THAAANK you so much! I just spent two weeks trying to get various configurations for environments to run on Ubuntu without success. Your videos worked without too many issues back on Windows. Though I had to build Darknet based on what "The AI Guy" instructed.
Working Specs:
Windows 10
GTX 1070
GPU Driver: 456.71
CUDA: 11.0.194
cuDNN: v8.0.5.39
NSight: 2020.3.2
OpenCV + contrib: 4.5.1
cMake: 3.20.1
Anaconda 3: 2020.11
Visual Studio Community 2019
PS: If you want to see GPU/CUDA utilization in the task manager you can change the graphs with their drop-down menus in their top left corners.
I am glad it was helpful. And kudos to "The AI Guy".
Thank you Thank you Thank you. this is the clearest video so far. You solved my no module error after countless frustrating hours.
I am glad it was helpful.
dude, i did everything, i successfully switched to gpu, but anaconda prompt does not work, only IDE works. thank you so much for everything you are my hero :D
Thank you so much!! It worked. And initially, I used native Python. It threw an error saying "Couldn't find some dll" so I switched to Anaconda and it worked! May be path issues I guess. But it worked. Thanks again!
Thank you. Only guide that really works. Every other guide didn’t, holy moly! Thanks! Saved my life
I am glad it worked out for you.
the installation worked in the base environment perfectly, but when I tried it in the virtual environment when I entered "import cv2" I get the following message: "ImportError: OpenCV loader: missing configuration file: ['config-3.8.py', 'config-3.py']. Check OpenCV installation." -- how do I fix this?
Hey TheCodingBug, nice to meet you! I just found your channel and subscribed, love what you're doing!
I like how clear and detailed your explanations are as well as the depth of knowledge you have surrounding the topic! Since I run a tech education channel as well, I love to see fellow Content Creators sharing, educating, and inspiring a large global audience. I wish you the best of luck on your UA-cam Journey, can't wait to see you succeed! Your content really stands out and you've put so much thought into your videos!
Cheers, take care, and keep up the great work!
Thank you for the appreciation. It's great to see people making a difference and spreading data literacy.
@@TheCodingBug No problem, thank you for the kind words as well!
Still showing unavailable for python3 in CMake. Please help me to solve it.
I followed the instructions as the video, but python3 kept appearing as unavailable. So I uninstalled anaconda and installed it again, but this time selecting the advanced option "Add Anaconda3 to my PATH environment variable". Then I followed the rest of the video and now it is working perfectly.
I hope this will be helpful for someone else.
Great tutorial!
But, I want to fill the gap that you missed on 8:55.
Before you upgrade numpy, you should install the numpy first at the environment, after that, you can upgrade it.
I missed that part, which confusing me little bit at first, because no numpy at my environment.
Anyway, I subs you tho!
Thank you for this information.
i had an error when i tried to configured in cmake. The eroor is "error in configuration process, project file may be invalid" what should ı do?
i installed visual studio a while ago. So i dont knowif I had press the c++ part. is it because of that? I looked up and ı installed visual studio 2019 in my D server. İs it a problem? because cmake is in my C: server.
If you've got error like this "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include\crt/host_config.h(143): fatal error C1189: @/error: -- unsupported Microsoft Visual Studio version! Only the versions between 2013 and 2017 (inclusive) are supported!" ,go to Program Files -NVDIA GPU Computing Toolkit CUDA -version -include and crt folder. In host_config.h file change line 141 #if _MSC_VER < 1700 || _MSC_VER >= 2000 instead of #if _MSC_VER < 1700 || _MSC_VER >= 1920.
Use same versions of visual studio, CUDA and cuDNN as shown in the video.
If anyone has problems at 4:25, where you have numpy 1.19.2 and still the message "Unavailable: java python2 python3" appears, install numpy 1.19.2 through pip ( pip install numpy==1.19.2 ) instad of conda. At least it worked for me. Also, upgrading/just installing numpy will upgrade/install to 1.20.1, which is not compatible
I wasted a few hours figuring this out
I did that. Still have same problem. What the problem should be?
You solved that problem
Thanks, but i'm stuck here:
"C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build" --target INSTALL --config Release
Unexpected token 'build' in expression or statement.
please help!
Thank you so much for the clean up at the end very very very very helpful and useful!!
You must have had previous installations as from a fresh Win10 installation this tutorial doesnt work. DLLs are missing. For example when installing Anaconda you need to add it to the path for those api dlls.
I am getting MSBuild error project file not found. please guide
You forgot to click "Generate" inside of Cmake after the configurations were set.
Hi, I get this error although I try to do exactly as you do:
CMake Error at modules/dnn/CMakeLists.txt:39 (message):
DNN: CUDA backend requires cuDNN. Please resolve dependency or disable
OPENCV_DNN_CUDA=OFF
Call Stack (most recent call first):
modules/world/CMakeLists.txt:13 (include)
modules/world/CMakeLists.txt:32 (include_one_module)
The cuDNN and CUDA versions do not match.
For those who have not found python 3 even after updating numpy I found same error but it was due to my anaconda path was not set in system environment variables when I did that it installed properly and opencv was build properly without any error
I hope it helps someone else.
@@TheCodingBug Thankyou for such great effort it was the best tutorial for opencv cpu installation short and clear👍keep up the good work
hi how did you do it?
@@kristelquezon4624 I did everything as mentioned in the video but build for python was still unavailable so when I completed the whole process i found that in the end the python folder would be missing which would contain the main file
Then after that I tried to recheck what was missing and I found that my anaconda path was not there in system environment variable so when I added that the error disappeared you can just search environment variable in your windows search bar you will find two things i found two things environment variable for lenevo(I have legion 5 pro) and below was system variable try to add your required python path to 'system' variable
After clean installation...
I am facing this error:
ImportError: DLL load failed while importing cv2: The specified module could not be found.
Nice tutorial. It is worked and I resolved my problem to implement opencv with gpu.
I am glad it was helpful.
Thanks man...I follow your tutorial and it works..
helping others out. don't use the console command he gives. (if it's not populating the install folder)
instead do this in the build folder (assuming the install folder should be in the build folder)
cmake --build . --config Release
cmake --install . --config Release
instead of anaconda3 it shows this path C:/Users/Jatin/AppData/Local/Programs/Python/Python37-32/Lib/site-packages
how to handle?pls help
Looks like you have multiple versions of Python. You can change all the paths to Anaconda.
MSBUILD : error MSB1009: Project file does not exist. what is the error in CMAKe
al steps fine , but i dont find the python3 folder inside lib, no pyd file of python3 that it is checked and all paths are done
Hi, I need help... Its really emergency
CMake Error at cuda_compile_1_generated_gpu_mat.cu.obj.Release.cmake:220 (message):
Error generating
C:/OpenCV_Build/build/modules/world/CMakeFiles/cuda_compile_1.dir/__/core/src/cuda/Release/cuda_compile_1_generated
_gpu_mat.cu.obj
I'm getting this error when I run this command: "C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build" --target INSTALL --config Release
Thank you so much for your explanation.. it helps a lot and saves a lot of time.
Yes, this tutorial worked. Thanks a lot.
Hi
7:29 I have python3 and Release
but it folder is empty what should i do now
This Tutorial Helps me a lot! Thank you so much!😊
I am glad it was useful.
@TheCodingBug had to use cuda 11.2 due to rtx 3070 showing some warnings with DLL when installing.
Eventually got to the point where I import cv2 in gpu environment still says no module named cv2 followed all steps with clean plate and apart from warning in cmake about wrong version of python that asked me to add something to path file there were no other problems. Any idea how to solve it?
PS. import cv2 in python does work without gpu ve
thanks for explaining this so clearly, it's really helpfull 🤗
Thank you very much bro
Thanks!! Finally I having be able to run it.
Good to hear.
Awesome, brief and applied.
Everything worked and installed perfectly in my vir env but when I try your test_script.py it returns following error:
(C:\Users\Dell\MyEnv) C:\Users\Dell> python test_script.py
Traceback (most recent call last):
File "test_script.py", line 13, in
cuMat1.upload(npMat1)
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-i1s8y2i1\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'
also when I try cv2.cuda.getCudaEnabledDeviceCount() it returns 0
Hi, you are my last hope, I am using OpenCV 4.4.0 with numpy 1.20.0, trying to bind tensorflow version 2.4.0 and it gives me an error (NotImplementedError: Cannot convert a symbolic Tensor (random_zoom/zoom_matrix/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported), but it also works fine on numpy version 1.19.2, but from this version CV2 crashes with an error (RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd). Please tell me what could be the problem?
python 3.8.5
I am getting this error in cmake :
CMake Error at modules/dnn/CMakeLists.txt:45 (message):
DNN: CUDA backend requires cuDNN. Please resolve dependency or disable
OPENCV_DNN_CUDA=OFF
Call Stack (most recent call first):
modules/world/CMakeLists.txt:13 (include)
modules/world/CMakeLists.txt:32 (include_one_module)
CUDA is installed
CUDNN is installed and added to enviroment variables
nvcc --version is working
In my case, all going smoothly but the cmkae cmd stop at this "opencv_test_core SSE4_2.vcxproj -> C:\FILES\OPENCV_BUILD\Build\modules\world\opencv_test_core SSE4_2.dir\Release\ope ncv_test_core_SSE4_2.lib" and no other explanation, just stop at that. In a video the command prompt say "installing" when done but mine different. Anyonw how to solve it? Thank you
That was very helpful, thank you so much!
i have entered this code to cmd "C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build" --target INSTALL --config Release. But i got error. Because Cmake want to create a file in Windows apps folder. But this folder is read-only and i cant change it. I checked everything i did. Can you help me?
Start cmd as administrator and try again.
@@TheCodingBug i have already tried it
First of all nice tutorial. Was frusturated for 3 days. The only problem was when I tried the test_script.py on my RTX3060 notebook CPU time was lesser than CUDA
same issue here what did you do for sloving that issues
when i install opencv in virtual environment it shows error
"C:\openCV_build\opencv-4.5.1\modules\python\src2\cv2.cpp(33,10): fatal error C1083: Cannot open include file: 'numpy/nd
arrayobject.h': No such file or directory [C:\openCV_build\build\modules\python3\opencv_python3.vcxproj]"
what should i do.
Did this error get resolve?
thanks bro. you're awesome!
Hi, my CMake is using the normal python on my system and not the Anaconda's python.exe. Is there a way to configure cmake to use anaconda python?
Yes. Change all the paths to Anaconda ones. See the part where I changed paths for virtual environment.
@@TheCodingBug oh thanks!! after changing the paths, do I configure again or just generate?
@@mallvin2000 Configure again.
@@TheCodingBug Thanks!! Last question sir sorry, do I clear the cache then configure or just click configure again?
@@mallvin2000 clear the cache first.
hi, when I tried installing opencv using cmake, I get an error saying "error in configuration process, project files may be invalid". How to fix this please help.
C:\Program' is not recognized as an internal or external command,
operable program or batch file.
sir this error occurs..how to fix it
Thanks dude ! :) This is really nerves saving.
I am glad it was helpful.
@@TheCodingBug please reply to my issue as well
how do i include the paths needed in my project on pyinstaller? i always get these errors after the .exe has been built regarding the opencv;
" File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "cv2\__init__.py", line 102, in
File "cv2\__init__.py", line 62, in bootstrap
File "cv2\__init__.py", line 60, in load_first_config
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation."
how do i fix these?
If you have module not found error, you may need to launch python from anaconda terminal using "python" instead of the shortened "py". I had it installed properly, but spent forever trying to fix it because of this stupid thing. Apparently py does not launch the anaconda activated or anaconda base environment, but launches some other version of python. Hope this helps someone else.
Thank you for sharing your experience. Maybe it'll help someone.
Hey coding bug I wanted to ask does the old version of gpu like GTx 1050 will work on this ? please reply its urgent need
At the time of recording this tutorial, it worked on GTX1050 amd GTX1060. Not sure now after release of new versions of opencv, cuda, and visual studio.
I am not getting cv2 in site packages...can you pls tell what's the problem
My problem is when chosing cuda_arch. it dosen;t have any version to selecting. When I select the version fit to mine. it doesn't;t work. Error happened. How to solve?
When I change the python path to my virtual environment it doesn't update the python version so it tries to install 3.7 on my 3.9 virtual env.
By following this video also i was not able to do "import Cv".. .then i reinstalled Anaconda by choosing the Path to the environment variable and then finally i got " import Cv". currently i am using python 3.10.9..with this version i tried to create a Virtual environment.. but i am facing error here..
the error is like :
(base) C:\Users\FHW>conda create -n opencv_gpu python-3.10
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed.
can you please help me with this ?
Thank you!
Saved us
Worked perfectly. Please mention how long it takes to build as it took me more than an hour and I thought of stopping it in between, glad I didn't do it. Thanks
It takes 45 minutes on my SSD and 1.8 hours on HDD.
@@TheCodingBug it takes nearly 4 hours on a Core i7-6850K with NVMe SSD and 64 GB of RAM. What are you guys running ? 64-core EPYC's ???
@@TheNefastor 4 250GB SSDs in RAID0 configuration.
@@TheCodingBug What's your processor ?
@@TheCodingBug I found the "problem" : you forgot to mention one cmake setting. I was building for ALL supported CUDA architectures instead of the latest (8.6). Changed that and now I compile in less than 30 minutes. Seems like you should mention it.
Hi, @TheCodingBug, I followed your all steps, but last command didn't generate cv2 library. and and during running, I found a warning message. "error C2065: 'DIFFERENT_SIZES_EXTRA' : undeclared identifier [C:\OpenCV_Build\build\modules\world\opencv_test_cudawarping.vcxproj]". Kindly resolve my issue.
cmake-gui wont recognize my numpy lib even though I upgraded it
Use the version that I used.
got as far as to upgrading numpy which was succesfull then I hit cmake configure but it doesnt change anything while compiling I see "no numpy module"
Thanks for the great tutorial. Is there any performance change between with and without GPU?
Yes.
ua-cam.com/video/FjyF03uawsA/v-deo.html
ua-cam.com/video/GXcy7Di1oys/v-deo.html
i have python 3.7.0 and cuda 10.1 in windows 10.I got error in cmake install in command prompt
I am trying to configure OpenCV 4.6 in the virtual environment. However, the program is unable to detect numpy even after running the --upgrade command of numpy to the latest version. I even checked whether numpy is installed in the virtual environment, even after numpy being installed, CMake is still not detecting the numpy version in the NUMPY_INCLUDE_DIRS section. After several attempts, I even manually copied the numpy's installed path in the virtual environment to the NUMPY_INCLUDE_DIRS slot to see atleast if that works. It still won't detect numpy's version. It still mentions python3 bindings unavailable. How to solve this?
Your assistance on this would be greatly beneficial.
I followed the steps as mentioned in the tutorial. But opencv build was not available for python3 (3:40 in the tutorial). I deleted build and configured again and now opencv build is available for python3. Even I did not downgrade numpy as specified in the tutorial. Hope this helps for someone !!!
i did it but still doesn't available for python3 however i've tried every way
you just explained the procedure, but not why you are doing what you are doing, would be great if you did
There are some functions in cv2 that can use GPU acceleration. You can see it in action in my other tutorial "Face Detection Using OpenCV with CUDA GPU Acceleration"
c1xx : fatal error C1356: mspdbcore.dll est introuvable (not found))) after executing the command in description
Hi there, it seems even after upgrading numpy the openncv module shows python3 unavailable. how to resolve this?
same problem here
@@sebastianm3505 I had to reinstall Anaconda (and I chose to include the path during the installation, not sure if that was necessary). I had two versions of Anaconda installed somehow. I had upgraded Anaconda and it showed up twice in Windows Apps and Features so I uninstalled both and then reinstalled. Anyways, that worked for me. YMMV.
@@RobertJohnson-xg5kh thanks that was solved with clean installation all steps again. Still stuck on another error
Bro I am getting this error " (-217:Gpu API call) cuDNN did not return a suitable algorithm for convolution. in function " Can you please help me with this .Please
Thanks for your help, but i still have a problem with openCV, it works fine, but when i try to execute my OpenCV project with pyinstaller or auto-py-to-exe Opencv is not imported and the executable file won't start. have any idea on how to fix this
hello great video !! ,
I have a question I followed every step but when I try to import in anaconda I get this error
\anaconda3\lib\site-packages\cv2\__init__.py", line 109, in load_first_config
raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.9.py', 'config-3.py']. Check OpenCV installation.
Hi, I was doing all steps in order and I did not receive any errors. However, in the final step, when I want to “import cv2”, I’ve got this error?
“DLL load failed while importing cv2: The specified module could not be found”
Do you have any idea how can I solve this problem?
I had: Windows 10 Enterprise N LTSC
GPU 980 GTX
Having Nvidia GeForce 1650, when I run a code before this, fps was 5-6 but after this it is still 8-9. In other words, it didn't increase as I expected. Is this normal?
Hello, good tutorial, but im unable to configure the opencv the second time with error error LNK2019: unresolved external symbol fseeko referenced in function main [C:\OpenCv_Build\build\CMakeFiles\CMakeTmp\cmTC_7a241.vcxproj], i follow the steps accordingly (except redownloading the vs 2019) any solutions? Thank you
It would be a good idea to do a video on steps to update opencv and tensorflow gpu versions. Always afraid I mess up something if I simply uninstall the previous version.
That's true. For tensorflow, it's really easy. Just see the supported cuda and cudnn versions against a particular tensorflow version and install them. Use Anaconda for that.
For opencv, it becomes headache though.
i want see opencv4.6.0 with cuda please i need help
After your command cmake could not load cache
Hey nice tutorial, i get it all right untill i get this error when running the test script : Traceback (most recent call last):
File "test_script.py", line 13, in
cuMat1.upload(npMat1)
cv2.error: OpenCV(4.5.3) C:/OPEN_CV/opencv-4.5.3/opencv-4.5.3/modules/core/src/cuda/gpu_mat.cu:116: error: (-217:Gpu API call) initialization error in function '::DefaultAllocator::allocate' could anyone help please
Dear coding bug, while configuring the, I get a lot of SSL connect errors. Configuration completes but these errors are written while loading. Would this be a problem? I could not manage to do what you said. Could it be not happening because of these SSL connect errors I got?
It is showing alot of warnings is it ok ???...Please Guide
Yes warnings are okay.
I had ssl / TLS error when cmake tried to make download ;(
Hİ TheCodingBug,
First of all thanks for this nice video!!
I am getting the following warning in the opencv_world folder when installing OpenCV on Windows 10. Do you have any information about what originated from? Is it important?
warning : field of class type without a DLL int
erface used in a class with a DLL interface
Thank you for your comment.
This warning is okay. If there are no errors, everything will work fine at the end.
fatal error C1001:Internal error in
the compiler. [C:\Build\modules\core\opencv_test_core_AVX512_SKX.vcxproj] I have this error every time I want to install openCV, do you know any solution? I follow the steps of other tutorials, but I got the same error.
it didn't worked even updating numpy
good stuff! subscribed
do you have a plan to do a session on how to build opencv with cuda on linux (say ubuntu)? im sure many are interested.
I'll make that in the first half of February.
@@TheCodingBug great looking forward to your video!
I followed this tutorial and it recognizes my gpu and even run simple codes for gpu test. But when i run a code with cv2.dnn.DNN_BACKEND_CUDA and cv2.dnn.DNN_TARGET_CUDA nothing happens. It doesn't show any module missing or any error message, but the video where it should appear the detected objects crashes. The code isn't the problem because i tested it on google colab and works fine. Also it works fine when i let with cpu parameters. Could you tell me what do you think is may causing this problem? Thanks in advance for your attention !!
Maybe things are changed over the years. I'll look into it next month.
Hi, thanks for the detailed video. I followed the steps exactly as per the video (excluding the virtual environment part as I don't think I need?) but when I try and import cv2 as cv and copy your test script, calling cv.cuda_GpuMat() and other functions such as cv.imshow() and cv.imread(), pyCharm says it cannot find the reference and as such the library doesn't work. Do you know why this might be? Thanks!
Hi.
Test it in Anaconda prompt. If it works there, there might be additional configuration required for p.ycharm
Thank you very much this works! Is there a way to use this with virtual environment without anaconda?
Yes. Any Python path in Cmake can be used. It doesn't matter if it's for Anaconda or any other Python distribution.
@@TheCodingBug edited, nvm it worked. Haha thank you very much!
Could you do the same introduction for C++?
help a lot, thx
Why I build take so long, more than 4 hours?
It depends on computer specs. It takes more time on HDD than SSD.
Please help me, I have write same code in build using CMD like in the video (7:07)
"C:\Program Files\CMake\bin\cmake.exe" --build "C:\OpenCV_Build\build"--target INSTALL --config Release
Error: C:/OpenCV_Build/build--target is not a directory
and get error like this, what shoul i do?
Try copying command from the description and paste it.
@@TheCodingBug Thankyou sir! done, but. If I import cv2 by code in cmd, cv2 is detected. and if I run by IDLE python, cv2 still not detected. what should I do?
@@jonarad9955 it seems your IDE is using a virtual environment. You have to build for that environment as well or change IDE settings to use base Python environment.
Also, make sure there are no multiple Python distributions installed (let's say Anaconda and native Python).
Is it also possible to perform all the setups for installing opencv with gpu support
with both native installation of python and anaconda or we just need to keep Anaconda ?
You can do it with native Python too.
it works for once ,then i get ImportError: DLL load failed while importing cv2: The specified module could not be found. this error
Make sure you've activated the virtual environment.