Skip to content

opencv 4.2 and support for cuda #295

Closed
@grzegorzk

Description

@grzegorzk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions