I‘m using the Xavier NX with Jetpack 4.4.1 and Opencv 4.1.1. CUDA support is not activated, so my program is very slow.
I’m not a great expert. What is the safest way to install Opencv with CUDA?
Have I to remove Opencv 4.1.1 first?
Will a future Jetpack version support Opencv with CUDA?
Thank you in advance,
best regards,
Wilhelm
The Best way to use CUDA supported OpenCV is building from source.
Refer following link:
modified,
When you configuration, make sure " CUDA_ARCH_BIN="7.2"" is enabled!
The number is for the Jetson Xavier.
Thank you very much.
There ist only the variable ARCH_BIN=5.3.
So I change it to ARCH_BIN=7.2 ?
Is that ok?
You’d better add/check more flags;
-
ARCH
-D CUDA_ARCH_BIN="7.2"
-
CUDNN: check your /usr/include/cudnn_version.h or /usr/local/cuda/include/cudnn.h
-D WITH_CUDNN=ON
-D CUDNN_VERSION='8.0'
-
pkg-config
-D OPENCV_GENERATE_PKGCONFIG=ON
Thank you for your support. I’ve entered the changes in buildOpenCV.sh, see below.
Is it ok?
The cudnn files are in usr/include. See the versions in the screenshots.
I’m trying to detect meteors with meteor scattering, but the program stutters a bit, because opencv is too slow.
Best regards,
Wilhelm
#!/bin/bash
# License: MIT. See license file in root directory
# Copyright(c) JetsonHacks (2017-2019)
OPENCV_VERSION=4.1.1
# Jetson Nano
##################??????
# ARCH_BIN=5.3
ARCH_BIN=7.2
######################################
INSTALL_DIR=/usr/local
# Download the opencv_extras repository
# If you are installing the opencv testdata, ie
# OPENCV_TEST_DATA_PATH=../opencv_extra/testdata
# Make sure that you set this to YES
# Value should be YES or NO
DOWNLOAD_OPENCV_EXTRAS=NO
# Source code directory
OPENCV_SOURCE_DIR=$HOME
WHEREAMI=$PWD
# NUM_JOBS is the number of jobs to run simultaneously when using make
# This will default to the number of CPU cores (on the Nano, that's 4)
# If you are using a SD card, you may want to change this
# to 1. Also, you may want to increase the size of your swap file
#####################Modifications##########################
# NUM_JOBS=$(nproc)
NUM_JOBS=1
-D CUDA_ARCH_BIN="7.2"
# CUDNN: check your /usr/include/cudnn_version.h or /usr/local/cuda/include/cudnn.h
-D WITH_CUDNN=ON
-D CUDNN_VERSION='8.0'
# pkg-config
-D OPENCV_GENERATE_PKGCONFIG=ON
####################End of Modifikations##########################
CLEANUP=true
I have successfully installed opencv. Only the -D had to be removed.
The GPU load is about 20-40% with my programm.
Mt. Hiker, thank you very much.
Best regards,
Wilhelm