EasyOCR disables Cuda GPU when installed - opencv

Hello after installing EasyOCR via pip install easyocr via Anaconda Prompt (base) I receive this error.
OpenCV(4.5.4)
D:\a\opencv-python\opencv-python\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'
Before installing easyocr, cuda is active and working with my GPU, but is disabled after installing EasyOCR.
I complied my build via Cmake using opencv4.5.4 and opencv-contrib4.5.4 with Cuda 11.3.1 and Cudnn 8.4.0 as well as uprading tot he most recent numpy 1.22.3.
It seems that after installing eascyOCR is changes my opencv build from whatever I am using to "opencv-python-headless-4.5.4.60" and that is I believe where the issues is at.
This is the version of easyocr installed.
Downloading opencv_python_headless-4.5.4.60-cp39-cp39-win_amd64.whl (35.0 MB)
Successfully installed easyocr-1.4.2 opencv-python-headless-4.5.4.60 python-bidi-0.4.2
Any idea or help on how I can get easyocr working with Cuda and my GPU?

Solved,
Have to install EasyOCR first
Then build OPENCV

Related

python3-wheel installed, still using legacy 'setup.py' when installing dlib

I've forked dlandon's Zoneminder project in order to build a Docker image using Debian Bullseye instead of Ubuntu, for i386 (I'm installing it into a 32-bit mini PC).
Part of the requiriments is installing dlib (latest is 19.22.0). I've installed the required dependencies (python3-pip, python3-setuptools and python3-wheel, as well as GCC and CMake).
When installing dlib, the terminal outputs:
Collecting dlib
Downloading dlib-19.22.0.tar.gz (7.4 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib: started
...
The relevant part is (even with python3-wheel installed)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
dlib builts successfully but takes a looong time to build, however. This happens with any packages supossed to use wheel.
I haven't found any (answered) questions about this specific issue, so, if there is something I missed, I would be told about that.
Everything is in the Dockerfile.
try pip install wheel in your env

Tiny yolo v4 dnn module opencv no detection

I'have trained yolo-tiny-v4 on colab and the detection works well on colab.
Then I've tried to load the yolo-tiny-v4 in this way on visual studio integrated with Gazebo/ROS:
No error appears, but the detection fails (no object detected, the output of the detection is a vector of Nan).
I'm using OpenCV Version: 4.2.0 and Python 2.7.17 in visual studio.
Any idea?
Try compiling OpenCV >= v4.5.0 from sources.
Compiling version 4.5.0 from sources solved the issue for me in Python 3 and I checked it also works in Python 2.7.
I initially got the same issue with Yolo Tiny v4 and Python 3.7, both on Raspberry Pi 4 and Windows 7, with OpenCV installed via pip install opencv-contrib-python (seems not available for Python 2.7 ?).
I tried different versions iteratively, got from pip or recompiled from sources (latest version available via pip on Raspbian was 4.1.0.25):
opencv-contrib-python==3.4.10.37 no detections (tested on Windows)
opencv-contrib-python==4.1.0.25: no detections (tested on Rasbian Buster and Windows)
opencv-contrib-python==4.2.0.34: no detections (tested on Windows)
opencv-contrib-python==4.3.0.38: no detections (tested on Windows)
opencv 4.4.0 compiled from sources: no detections (tested on Rasbian Buster)
opencv-contrib-python==4.4.0.40: ok (tested on Windows)
opencv-contrib-python==4.4.0.46: ok (testd on Windows)
opencv 4.5.0 compiled from sources: ok (tested on Rasbian Buster)
Versions a little after opencv-contrib-python==4.4.0.40 seemed to works, so the "next" version available on Raspbian at the time was v4.5.0 from sources.

Using GPU in OpenCV

If I want to use my computer's GPU with OpenCV, is it necessary that I build OpenCV from source with CUDA enabled? Or can I install OpenCV with CUDA support via apt-get? I noticed the following 2 packages in apt-get:
libopencv-gpu-dev - development files for libopencv-gpu2.4v5
libopencv-gpu2.4v5 - computer vision GPU library
But I am not sure if these will work with OpenCV3 or if they are only compatible with OpenCV2. I know that the gpu module in Opencv2 was split up into multiple CUDA modules in OpenCV3.
Yes it is necessary that you build opencv from the source with CUDA option enabled. The apt-get packages won't work with OpenCV3 and above versions. I suggest you install the CUDA Toolkit first and then attempt installation of OpenCV or the GPU functions won't work.

Compiling OpenCV-contrib for IOS (especially the SFM-Module)

I've tried to install openCV_contrib for IOS, therefore I execute
python opencv/platforms/ios/build_framework.py "framework_dest"
on my Mac (I need Xcode for compiling openCV for IOS) but all the times, i got the message:
-- Checking SFM deps... FALSE
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
I need the SFM module, hence I tried installing Glog and Gflags at several ways: using
brew install glog gflags
and brew outputs, that those packages are successfully installed respective already installed.
Later I tried to compile both from GitHub on my own, but with no success, I'm still not able to compile SFM for IOS.
On Linux I could compile openCV including the SFM module, but I can't compile it for IOS, because Xcode is not available for Linux.
I don't know, what to do! Do some of you know how to install glog/gflags on Mac or do you know how to build the IOS-Framework of OpenCV on Linux or maybe how to build the IOS-Framework on my Mac using the binaries created with cmake .. && make in my Linux (because there SFM is compiled)?
There have to be some solution, because Mac is based on Linux, so if it works on Linux, why doesn't it work on my Mac?!
Thanks!

Can not find CUDA_NPP_LIBRARY_ROOT_DIR in cmake

I am trying to install opencv 2.2 with cuda enabled. I have installed CUDA and also have compiled and tested some programs with it.
Now I want to install opencv with gpu. I downloaded cmake-gui and set CUDA on. When I hit the configure button it does find cuda toolkit but gives me this error:
CMake Error at modules/gpu/FindNPP.cmake:102 (message):
NPP headers/libraries are not found. Please specify
CUDA_NPP_LIBRARY_ROOT_DIR in CMake or set $NPP_ROOT_DIR.
Call Stack (most recent call first):
modules/gpu/CMakeLists.txt:38 (find_package)
I have installed everything in the default directory.
My cuda-toolkit version is 4.0. Also I have opencv 2.2 without gpu installed.
And in case it might help:
My OS is ubuntu 11.04, my gpu is geforce gtx550, and my cuda driver version is 280.13

Resources