Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencv 4.2 and support for cuda #295

Closed
grzegorzk opened this issue Feb 20, 2020 · 1 comment
Closed

opencv 4.2 and support for cuda #295

grzegorzk opened this issue Feb 20, 2020 · 1 comment

Comments

@grzegorzk
Copy link

grzegorzk commented Feb 20, 2020

Hi, this is not a bug report but rather a question. I'm sorry to ask this again (question was already asked in #201 and #71) but the OpenCV modules page mentions cuda modules.

Am I correct to understand that opencv-python should now support cv2.dnn.DNN_BACKEND_CUDA and cv2.dnn.DNN_TARGET_CUDA? On my dev machine I'm getting [ WARN:0] global /io/opencv/modules/dnn/src/dnn.cpp (1363) setUpNet DNN module was not built with CUDA backend; switching to CPU so I guess there are some extra steps needed.

I'm looking through travis.yml and also what @alsrgv suggested within #71 - I understand I need to build the package myself with CUDA enabled.

This is how I build it (running within archlinux docker container):

pacman -Sy base-devel python python-pip git cmake
git clone https://github.com/skvark/opencv-python
cd opencv-python
ENABLE_CONTRIB=1 python setup.py bdist_wheel -- \
    -MB_PYTHON_VERSION=3.8 \
    -ENABLE_HEADLESS=0 \
    -DWITH_CUDA=ON \
    -DENABLE_FAST_MATH=1 \
    -DCUDA_FAST_MATH=1 \
    -DWITH_CUBLAS=1 \
    -DCUDA_ARCH_BIN=7.5 -- \
    -j8

Above fails:

CMake Error at /usr/share/cmake-3.16/Modules/FindQt4.cmake:1314 (message):
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
cmake/OpenCVFindLibsGUI.cmake:30 (find_package)
CMakeLists.txt:672 (include)


-- Configuring incomplete, errors occurred!
See also "/python-opencv-cuda/opencv-python/_skbuild/linux-x86_64-3.8/cmake-build/CMakeFiles/CMakeOutput.log".
See also "/python-opencv-cuda/opencv-python/_skbuild/linux-x86_64-3.8/cmake-build/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 570, in setup
env = cmkr.configure(cmake_args,
File "/usr/lib/python3.8/site-packages/skbuild/cmaker.py", line 221, in configure
raise SKBuildError(

An error occurred while configuring with CMake.
Command:
"cmake" "/python-opencv-cuda/opencv-python/opencv" "-G" "Unix Makefiles" "-DCMAKE_INSTALL_PREFIX:PATH=/python-opencv-cuda/opencv-python/_skbuild/linux-x86_64-3.8/cmake-install" "-DPYTHON_EXECUTABLE:FILEPATH=/usr/sbin/python" "-DPYTHON_VERSION_STRING:STRING=3.8.1" "-DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8" "-DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython3.8.so" "-DSKBUILD:BOOL=TRUE" "-DCMAKE_MODULE_PATH:PATH=/usr/lib/python3.8/site-packages/skbuild/resources/cmake" "-DPYTHON3_EXECUTABLE=/usr/sbin/python" "-DBUILD_opencv_python3=ON" "-DOPENCV_SKIP_PYTHON_LOADER=ON" "-DOPENCV_PYTHON3_INSTALL_PATH=python" "-DINSTALL_CREATE_DISTRIB=ON" "-DBUILD_opencv_apps=OFF" "-DBUILD_SHARED_LIBS=OFF" "-DBUILD_TESTS=OFF" "-DBUILD_PERF_TESTS=OFF" "-DBUILD_DOCS=OFF" "-DOPENCV_EXTRA_MODULES_PATH=/python-opencv-cuda/opencv-python/opencv_contrib/modules" "-DWITH_QT=4" "-DWITH_V4L=ON" "-DENABLE_PRECOMPILED_HEADERS=OFF" "-DWITH_IPP=OFF" "-DWITH_CUDA=ON" "-DENABLE_FAST_MATH=1" "-DCUDA_FAST_MATH=1" "-DWITH_CUBLAS=1" "-DCUDA_ARCH_BIN=7.5" "-DCMAKE_BUILD_TYPE:STRING=Release"
Source directory:
/python-opencv-cuda/opencv-python/opencv
Working directory:
/python-opencv-cuda/opencv-python/_skbuild/linux-x86_64-3.8/cmake-build
Please see CMake's output for more information.

I have not used cmake before, I'm guessing I'm missing some dependencies.

@grzegorzk
Copy link
Author

I was missing qt4 on my system. After installing qt4 and also following some extra steps from here: opencv/opencv#14827 (comment) I managed to build the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant