I ran the script from here successfully:
but when I run cv2.cuda.getCudaEnabledDeviceCount() I still get “0”
What else do I need to do?
I ran the script from here successfully:
but when I run cv2.cuda.getCudaEnabledDeviceCount() I still get “0”
What else do I need to do?
Hi,
Please try this script:
JEP/install_opencv4.6.0_Jetson.sh at master · AastaNV/JEP · GitHub
CUDA_ARCH_BIN of Orin is 8.7. Please build with this configuration.
Thank you - I used the script it seems to work for python 2.7, but not for python 3.8. When I run the commands:
python
import cv2
cv2.cuda.getCudaEnabledDeviceCount
I get:
1
But when I run:
python3
import cv2
cv2.cuda.getCudaEnabledDeviceCount()
I still get:
0
How can I configure python3 to use cuda?
Hi,
It seems like it does not link to self-built OpenCV. Please check if the version is correct in python 3.8:
>>> cv2.__version__
It should work since the path of python 3.8 is included in the script:
echo 'export PYTHONPATH=/usr/local/lib/python3.8/site-packages/:$PYTHONPATH' >> ~/.bashrc
Ok, after loging in again all seems to work properly (I did not source the .bashrc after install)
Thank you!
Hi,
This works for python3.8, but I need this for python3.7…
I have installed the python3.7 interperter, but how do I install the opencv with CUDA for 3.7?
Hi,
You can modify the CMake command to build the OpenCV library for python 3.7.
For example, below are steps for building OpenCV with python 3.9.
** Install NumPy for python 3.9
$ sudo -H python3.9 -m pip install numpy --upgrade numpy
** Update CMake command for python 3.9
https://github.com/AastaNV/JEP/blob/master/script/install_opencv4.6.0_Jetson.sh#L62
$ cmake \
-D PYTHON_LIBRARIES=/usr/lib/python3.9/config-3.9-aarch64-linux-gnu/libpython3.9.so \
-D PYTHON3_EXECUTABLE=/usr/bin/python3.9 \
-D WITH_CUDA=ON -D WITH_CUDNN=ON -D CUDA_ARCH_BIN="7.2,8.7" -D CUDA_ARCH_PTX="" -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${version}/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
You should find python 3.9 in the CMake configuration:
-- General configuration for OpenCV 4.6.0 =====================================
...
-- Python 3:
-- Interpreter: /usr/bin/python3.9 (ver 3.9.5)
-- Libraries: /usr/lib/aarch64-linux-gnu/libpython3.9.so (ver 3.9.5)
-- numpy: /usr/local/lib/python3.9/dist-packages/numpy/core/include (ver 1.23.4)
-- install path: lib/python3.9/site-packages/cv2/python-3.9
--
...
Thanks.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.