opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
75.95k stars 55.61k forks source link

Compiling Opencv 4.2.0 + CUDA on jetson nano board #16439

Closed SaddamBInSyed closed 4 years ago

SaddamBInSyed commented 4 years ago

Hi. I have carefully followed the below link in order to install the OpenCV with CUDA support on the jetson nano board. but after a successful compile and I run my yolov3 object detection code BUT the application is still running on CPU only instead of GPU. https://github.com/JetsonHacksNano/buildOpenCV/blob/master/buildOpenCV.sh

Since I am a beginner I was struggling to configure my code to run/use GPU so that I can get better FPS compared to CPU.

please help me, anyone, to get rid of this issue and share the updated procedure to compile OpenCV with CUDA support on jetson nano.

I believe this post will surely help a lot of users since there is no updated information on the internet about compiling the installing OpenCV 4.2.0/master branch version into the jetson nano board.

note: I have run the Gpu graph app to check GPU usage percentage.

YashasSamaga commented 4 years ago

The build script you linked does not enable the CUDA backend for the DNN module.

Please try building with this script. I have added the WITH_CUDNN and OPENCV_DNN_CUDA to the cmake command.

SaddamBInSyed commented 4 years ago

@YashasSamaga Thank you for your reply. Do I need to purge the existing OpenCV lib's and install your build script? OR Is there any terminal cmd to execute these CMAKE flag's (WITH_CUDNN, OPENCV_DNN_CUDA) with existing installation? Note: In jetson nano, the OpenCV build taking around 4 hours.

please advise.

YashasSamaga commented 4 years ago

You have to purge the existing OpenCV installation and build using the script I provided. Your build time is 4 hours because you are building all the modules (even the ones you may not need). You might be able to reduce the build time by disabling the modules that you won't need.

SaddamBInSyed commented 4 years ago

Thank you much.

https://gist.github.com/YashasSamaga/e2b19a6807a13046e399f4bc3cca3a49

with the current installation when I try to execute your code I am getting the below error.

yolov3_opencv_dnn_cuda.cpp:9:10: fatal error: opencv2/core.hpp: No such file or directory

include <opencv2/core.hpp>

^~~~~~ compilation terminated.

can you please advise.

YashasSamaga commented 4 years ago

The OpenCV 4 headers are placed inside opencv4 directory. You need to use opencv4/opencv2/core.hpp or pass -I/usr/local/include/opencv4 to your compiler. For example,

g++ main.cpp -O3 -I/usr/local/include/opencv4 -lopencv_core -lopencv_dnn
SaddamBInSyed commented 4 years ago

Thank you, I will try to purge the existing cv libs and then install the OpenCV master branch repo with your script and once successful I will run the Yolov3 code and I will update the status.

SaddamBInSyed commented 4 years ago

Scanning dependencies of target tegra_hal [ 21%] Linking CXX static library ../../lib/libtegra_hal.a [ 21%] Built target tegra_hal Scanning dependencies of target opencv_cudev make[2]: No rule to make target '/usr/lib/aarch64-linux-gnu/libGL.so', needed by 'lib/libopencv_cudev.so.4.2.0'. Stop. make[2]: Waiting for unfinished jobs.... [ 21%] Building CXX object modules/cudev/CMakeFiles/opencv_cudev.dir/src/stub.cpp.o CMakeFiles/Makefile2:2547: recipe for target 'modules/cudev/CMakeFiles/opencv_cudev.dir/all' failed make[1]: [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 21%] Linking CXX static library ../lib/liblibprotobuf.a [ 21%] Built target libprotobuf Note: Class Feature2D has more than 1 base class (not supported by Python C extensions) Bases: cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm Only the first base class will be used Note: Class detail_GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions) Bases: cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder Only the first base class will be used [ 21%] Built target gen_opencv_python_source Makefile:162: recipe for target 'all' failed make: *** [all] Error 2

real 4m39.009s user 17m0.128s sys 0m52.252s Make did not build Retrying ... [ 3%] Built target libjasper [ 10%] Built target IlmImf [ 15%] Built target libprotobuf [ 15%] Built target quirc [ 19%] Built target carotene_objs [ 20%] Built target tegra_hal [ 20%] Built target ittnotify [ 21%] Built target ade [ 21%] Built target opencv_videoio_plugins make[2]: No rule to make target '/usr/lib/aarch64-linux-gnu/libGL.so', needed by 'lib/libopencv_cudev.so.4.2.0'. Stop. CMakeFiles/Makefile2:2547: recipe for target 'modules/cudev/CMakeFiles/opencv_cudev.dir/all' failed make[1]: [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2

SaddamBInSyed commented 4 years ago

@YashasSamaga

When I try to build your code then I am getting the below error. ( on jetson nano)

Scanning dependencies of target tegra_hal [ 21%] Linking CXX static library ../../lib/libtegra_hal.a [ 21%] Built target tegra_hal Scanning dependencies of target opencv_cudev make[2]: No rule to make target '/usr/lib/aarch64-linux-gnu/libGL.so', needed by 'lib/libopencv_cudev.so.4.2.0'. Stop. make[2]: Waiting for unfinished jobs.... [ 21%] Building CXX object modules/cudev/CMakeFiles/opencv_cudev.dir/src/stub.cpp.o CMakeFiles/Makefile2:2547: recipe for target 'modules/cudev/CMakeFiles/opencv_cudev.dir/all' failed make[1]: [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 21%] Linking CXX static library ../lib/liblibprotobuf.a [ 21%] Built target libprotobuf Note: Class Feature2D has more than 1 base class (not supported by Python C extensions) Bases: cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm Only the first base class will be used Note: Class detail_GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions) Bases: cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder Only the first base class will be used [ 21%] Built target gen_opencv_python_source Makefile:162: recipe for target 'all' failed make: *** [all] Error 2

real 4m39.009s user 17m0.128s sys 0m52.252s Make did not build Retrying ... [ 3%] Built target libjasper [ 10%] Built target IlmImf [ 15%] Built target libprotobuf [ 15%] Built target quirc [ 19%] Built target carotene_objs [ 20%] Built target tegra_hal [ 20%] Built target ittnotify [ 21%] Built target ade [ 21%] Built target opencv_videoio_plugins make[2]: No rule to make target '/usr/lib/aarch64-linux-gnu/libGL.so', needed by 'lib/libopencv_cudev.so.4.2.0'. Stop. CMakeFiles/Makefile2:2547: recipe for target 'modules/cudev/CMakeFiles/opencv_cudev.dir/all' failed make[1]: [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2

please advise

YashasSamaga commented 4 years ago

I am confused. The only changes I made were adding -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON. If the build script had worked before, it should still work.

Can you try the solution given here: https://devtalk.nvidia.com/default/topic/1051752/jetson-tx2/build-opencv-3-4-with-cuda-on-nvidia-jetson-tx2/post/5338614/#5338614

alalek commented 4 years ago

No rule to make target '/usr/lib/aarch64-linux-gnu/libGL.so'

@SaddamBInSyed You should check configuration flags of your build. Inspect CMakeVars.txt / CMakeCache.txt files first. Also re-check WITH_OPENGL (disabled by default) To work with reproducible results, you must cleanup CMake's cache before each trial with changing of configuration flags or upgraded/installed dependencies.


Build / usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org

SaddamBInSyed commented 4 years ago

The OpenCV 4 headers are placed inside opencv4 directory. You need to use opencv4/opencv2/core.hpp or pass -I/usr/local/include/opencv4 to your compiler. For example,

g++ main.cpp -O3 -I/usr/local/include/opencv4 -lopencv_core -lopencv_dnn

@YashasSamaga I have successsfully installed above advised your buildOPenCV4 script on jetson nano and when I run the "yolov3_opencv_dnn_cuda.cpp" file then I am getting the below "undefined reference" error.

please advise

g++ yolov3_opencv_dnn_cuda.cpp -O3 -I/usr/local/include/opencv4 -lopencv_core -lopencv_dnn -lopencv_imgproc /tmp/ccBlrJl0.o: In function main': main.cpp:(.text.startup+0x228): undefined reference tocv::VideoCapture::VideoCapture(int, int)' main.cpp:(.text.startup+0x384): undefined reference to cv::waitKey(int)' main.cpp:(.text.startup+0x398): undefined reference tocv::VideoCapture::operator>>(cv::Mat&)' main.cpp:(.text.startup+0x3cc): undefined reference to cv::waitKey(int)' main.cpp:(.text.startup+0x3fc): undefined reference tocv::VideoCapture::~VideoCapture()' main.cpp:(.text.startup+0xf8c): undefined reference to cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' main.cpp:(.text.startup+0xfec): undefined reference tocv::imshow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&)' main.cpp:(.text.startup+0x1704): undefined reference to `cv::VideoCapture::~VideoCapture()' collect2: error: ld returned 1 exit status

SaddamBInSyed commented 4 years ago

after linking lib its working fine. thank you.

g++ main.cpp -O3 -I/usr/local/include/opencv4 -lopencv_core -lopencv_dnn -lopencv_imgproc -lopencv_core -lopencv_videoio -lopencv_highgui

tadam98 commented 3 years ago

I have successfully compiled 4.2.0 for Jetson Nano with cudnn support and I am getting the following run time error. An ideas ?

cv2 version= 4.2.0
cv2 path= /usr/local/lib/python3.6/dist-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so
[INFO] setting preferable backend and target to CUDA...
[INFO] accessing video stream...
Traceback (most recent call last):
  File "ssd_object_detection.py", line 76, in <module>
    detections = net.forward()
cv2.error: OpenCV(4.2.0) /home/dlinano/Downloads/opencv/modules/dnn/src/dnn.cpp:1304: error: (-215:Assertion failed) preferableBackend != DNN_BACKEND_OPENCV || preferableTarget == DNN_TARGET_CPU || preferableTarget == DNN_TARGET_OPENCL || preferableTarget == DNN_TARGET_OPENCL_FP16 in function 'setUpNet'
SaiSandeepKantareddy commented 3 years ago

global /tmp/build_opencv/opencv/modules/dnn/src/dnn.cpp (1363)

setUpNet DNN module was not built with CUDA backend; switching to CPU

I have just followed the instructions given above, but this is the error I am getting and moreover the external camera is not able to detect the image in the webcam frame.

Any suggestions would help me.

YashasSamaga commented 3 years ago

@SaiSandeepKantareddy Please show the CMake output. Are you using buildOpenCv.sh?

tadam98 commented 3 years ago

Hi,

The cv2 components are here: https://github.com/opencv/opencv/issues/17372 as printed by the source I sent you.

If you need a full listing, I can run it again tonight and send you.

My "suspicion" is that maybe my models which came from pyimagesearch are for 32 bits and maybe the Jetson cuda needs 16bits and hence the errors ?

In the link above there is also a download link for the code (that you have) and the caffee model.

Best, Mickey


From: Yashas Samaga B L notifications@github.com Sent: Tuesday, May 26, 2020 4:42:27 PM To: opencv/opencv opencv@noreply.github.com Cc: tadam98 tadam_98@hotmail.com; Mention mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

@SaiSandeepKantareddyhttps://github.com/SaiSandeepKantareddy Please show the CMake output. Are you using buildOpenCv.sh?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-634032799, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT2OXFOB2DBCOGTJG3DRTPBMHANCNFSM4KLW76EA.

YashasSamaga commented 3 years ago

@tadam98 The code you sent is working on my computer. Are you sure that your locally built OpenCV 4.2 is being used instead of the OpenCV 4.1.2? (try printing cv2.__version__)

tadam98 commented 3 years ago

Hi,

Yes, it is working on a pc. The problem is on the jetson nano.

The printout in the github link i gave you was PRINTED BY THE PROGRAM ITSELF showing what the program sees in the cv2 library it is actually using. (See the 3rd print in the source from me, not the dowloaded one from phimagesearch)

Thus i am 100% certain it is using 4.2.0, with CUDA 10.2 and with cuDNN 8.0. (due to cuda 10.2 i had to correct cmake/FindCUDNN.cmake. Correcrions that worked well)

Before compiling the OpenCV 4.2.0 i did make uninstall and then a deep search after any remaining files of 4.1.2 and removed all. Including the 4.1.2 downloaded zips and compilation folders.

Best, Mickey


From: Yashas Samaga B L notifications@github.com Sent: Tuesday, May 26, 2020 6:33:40 PM To: opencv/opencv opencv@noreply.github.com Cc: tadam98 tadam_98@hotmail.com; Mention mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

@tadam98https://github.com/tadam98 The code you sent is working on my computer. Are you sure that your locally built OpenCV 4.2 is being used instead of the OpenCV 4.1.2? (try printing cv2.version)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-634100898, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT7XPCSJJMPDLMQLSH3RTPONJANCNFSM4KLW76EA.

YashasSamaga commented 3 years ago
CV_Assert(preferableBackend != DNN_BACKEND_OPENCV ||
                  preferableTarget == DNN_TARGET_CPU ||
                  preferableTarget == DNN_TARGET_OPENCL ||
                  preferableTarget == DNN_TARGET_OPENCL_FP16);

is the assertion that was triggered.

The only way this can be triggered is if the backend is set to DNN_BACKEND_OPENCV. What are the arguments you are passing to the script?

YashasSamaga commented 3 years ago

I was expecting to see a message that said OpenCV DNN had switched to CPU due to the unavailability of the CUDA backend. I don't see it. Can you try export OPENCV_LOG_LEVEL=INFO in the terminal where you run the python script?

tadam98 commented 3 years ago

During run time is what I sent you with the parameters to the models that come in the zip. It is identical to the instructions on their website.


From: Yashas Samaga B L notifications@github.com Sent: Tuesday, May 26, 2020 7:13:48 PM To: opencv/opencv opencv@noreply.github.com Cc: tadam98 tadam_98@hotmail.com; Mention mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

CV_Assert(preferableBackend != DNN_BACKEND_OPENCV || preferableTarget == DNN_TARGET_CPU || preferableTarget == DNN_TARGET_OPENCL || preferableTarget == DNN_TARGET_OPENCL_FP16);

is the assertion that was triggered.

The only way this can be triggered is if the backend is set to DNN_BACKEND_OPENCV. What are the arguments you are passing to the script?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-634125057, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT65JKOQEA72A4MAQCTRTPTDZANCNFSM4KLW76EA.

tadam98 commented 3 years ago

A command line parameter allows selection between use gpu or not. I tries both. So the problem is not with the gpu.

I will be by my pc in ah hour and will send you.


From: Yashas Samaga B L notifications@github.com Sent: Tuesday, May 26, 2020 7:19:02 PM To: opencv/opencv opencv@noreply.github.com Cc: tadam98 tadam_98@hotmail.com; Mention mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

I was expecting to see a message that said OpenCV DNN had switched to CPU due to the unavailability of the CUDA backend. I don't see it. Can you try export OPENCV_LOG_LEVEL=INFO in the terminal where you run the python script?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-634127941, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT4MFAIZ7ZUJM2XPFSLRTPTXNANCNFSM4KLW76EA.

SaiSandeepKantareddy commented 3 years ago

@SaiSandeepKantareddy Please show the CMake output. Are you using buildOpenCv.sh?

cuDNN : NO , but in your cmake file cuDNN is ON, but the system is not able to find the version required remaining all other say yes.

I suspect this could be a potential problem causer?

tadam98 commented 3 years ago

This is the runtime error:

[INFO] setting preferable backend and target to CUDA...
[INFO] accessing video stream...
**Traceback (most recent call last):
  File "ssd_object_detection.py", line 77, in <module>
    detections = net.forward()
cv2.error: OpenCV(4.2.0) /home/dlinano/Downloads/opencv/modules/dnn/src/dnn.cpp:1304: error: (-215:Assertion failed) preferableBackend != DNN_BACKEND_OPENCV || preferableTarget == DNN_TARGET_CPU || preferableTarget == DNN_TARGET_OPENCL || preferableTarget == DNN_TARGET_OPENCL_FP16 in function 'setUpNet'**

This is the OpenCV configuration as printed from the program itself at run time. So this is the opencv being used.

See below: ** NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH) NVIDIA GPU arch: 53 62 72 NVIDIA PTX archs:

cuDNN: YES (ver 8.0.0) **

Maybe the error is because of: Baseline: NEON FP16 in case the model is for 32bits and the engine is 16 bits?

I think there is no doubt that the OpenCV has CUDA and has cuDNN.

cv2 version= 4.2.0
cv2 path= /usr/local/lib/python3.6/dist-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so
cv2 Build Information=
General configuration for OpenCV 4.2.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /home/dlinano/Downloads/opencv_contrib/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2020-05-25T21:07:56Z
    Host:                        Linux 4.9.140-tegra aarch64
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               RELEASE

  CPU/HW features:
    Baseline:                    NEON FP16
      required:                  NEON
      disabled:                  VFPV3

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/bin/c++  (ver 7.5.0)
    C++ flags (Release):         -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--gc-sections
    Linker flags (Debug):        -Wl,--gc-sections
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          m pthread cudart_static -lpthread dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    python2 world
    Disabled by dependency:      -
    Unavailable:                 cnn_3dobj cvv java js matlab ovis ts viz
    Applications:                examples apps
    Documentation:               NO
    Non-free algorithms:         YES

  GUI:
    GTK+:                        YES (ver 3.22.30)
      GThread :                  YES (ver 2.56.4)
      GtkGlExt:                  NO
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O:
    ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
    JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
    WEBP:                        build (ver encoder: 0x020e)
    PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
    TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      YES (2.2.5)
    FFMPEG:                      YES
      avcodec:                   YES (57.107.100)
      avformat:                  YES (57.83.100)
      avutil:                    YES (55.78.100)
      swscale:                   YES (4.8.100)
      avresample:                YES (3.7.0)
    GStreamer:                   YES (1.14.5)
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Lapack:                      NO
    Eigen:                       YES (ver 3.3.4)
    Custom HAL:                  YES (carotene (ver 0.0.1))
    Protobuf:                    build (3.5.1)

  NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             53 62 72
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 8.0.0)

  OpenCL:                        YES (no extra features)
    Include path:                /home/dlinano/Downloads/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 /usr/bin/python3 (ver 3.6.9)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
    numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
    install path:                lib/python3.6/dist-packages/cv2/python-3.6

  Python (for build):            /usr/bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /usr/local
-----------------------------------------------------------------
YashasSamaga commented 3 years ago

@SaiSandeepKantareddy That's defnitely the problem. You need WITH_CUDA, WITH_CUDNN, WITH_CUBLAS and OPENCV_DNN_CUDA` set. Looking for lines that say "filtering out cuda4dnn source" in your CMake output. If you see this, it implies that the CUDA backend is not being built.

@tadam98 The assertion that is being triggered can only be triggered if the backend is set to DNN_BACKEND_OPENCV. If you're trying to use the GPU, the script should have set the backend to DNN_BACKEND_CUDA and that assertion shouldn't have been triggered at all.

tadam98 commented 3 years ago

See attached traces.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Yashas Samaga B Lmailto:notifications@github.com Sent: 27 May 2020 11:25 To: opencv/opencvmailto:opencv@noreply.github.com Cc: tadam98mailto:tadam_98@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

@SaiSandeepKantareddyhttps://github.com/SaiSandeepKantareddy That's defnitely the problem. You need WITH_CUDA, WITH_CUDNN, WITH_CUBLAS and OPENCV_DNN_CUDA` set. Looking for lines that say "filtering out cuda4dnn source" in your CMake output. If you see this, it implies that the CUDA backend is not being built.

@tadam98https://github.com/tadam98 The assertion that is being triggered can only be triggered if the backend is set to DNN_BACKEND_OPENCV. If you're trying to use the GPU, the script should have set the backend to DNN_BACKEND_CUDA and that assertion shouldn't have been triggered at all.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-634509466, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT2NM2765QYPLTUJJODRTTE7TANCNFSM4KLW76EA.

YashasSamaga commented 3 years ago

@tadam98 I don't see any attachment in mail nor on GitHub. Maybe GitHub doesn't support attachments via mail.

tadam98 commented 3 years ago

https://drive.google.com/folderview?id=1rotEOktKAFdQZhGJPr224A6aFpnZ3ubK

Try my google drive.


From: Yashas Samaga B L notifications@github.com Sent: Wednesday, May 27, 2020 5:05:45 PM To: opencv/opencv opencv@noreply.github.com Cc: tadam98 tadam_98@hotmail.com; Mention mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

@tadam98https://github.com/tadam98 I don't see any attachment in mail nor on GitHub. Maybe GitHub doesn't support attachments via mail.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-634683775, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT2S7WBGPS7TJ2JLBRTRTUM3TANCNFSM4KLW76EA.

tadam98 commented 3 years ago
Cmake trace

-- Detected processor: aarch64
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found version "1.2.11") 
-- TBB: Download: v2020.0.tar.gz
-- CUDA detected: 10.2
-- CUDA NVCC target flags: -gencode;arch=compute_53,code=sm_53;-gencode;arch=compute_62,code=sm_62;-gencode;arch=compute_72,code=sm_72;-D_FORCE_INLINES
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR) 
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Could NOT find Pylint (missing: PYLINT_EXECUTABLE) 
-- Could NOT find Flake8 (missing: FLAKE8_EXECUTABLE) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- OpenCV Python: during development append to PYTHONPATH: /home/dlinano/Downloads/opencv/build/python_loader
-- Caffe:   NO
-- Protobuf:   NO
-- Glog:   YES
-- freetype2:   YES (ver 21.0.15)
-- harfbuzz:    YES (ver 1.7.2)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/aarch64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
-- Checking for module 'tesseract'
--   No package 'tesseract' found
-- Tesseract:   NO
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Excluding from source files list: modules/imgproc/src/corner.avx.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
-- Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
-- Excluding from source files list: modules/imgproc/src/sumpixels.avx512_skx.cpp
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/dlinano/Downloads/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/aarch64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
-- OpenCL samples are skipped: OpenCL SDK is required
-- 
-- General configuration for OpenCV 4.2.0 =====================================
--   Version control:               unknown
-- 
--   Extra modules:
--     Location (extra):            /home/dlinano/Downloads/opencv_contrib/modules
--     Version control (extra):     unknown
-- 
--   Platform:
--     Timestamp:                   2020-05-25T21:07:56Z
--     Host:                        Linux 4.9.140-tegra aarch64
--     CMake:                       3.10.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   CPU/HW features:
--     Baseline:                    NEON FP16
--       required:                  NEON
--       disabled:                  VFPV3
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 7.5.0)
--     C++ flags (Release):         -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--gc-sections  
--     Linker flags (Debug):        -Wl,--gc-sections  
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          m pthread cudart_static -lpthread dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    python2 world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cvv java js matlab ovis ts viz
--     Applications:                examples apps
--     Documentation:               NO
--     Non-free algorithms:         YES
-- 
--   GUI: 
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
--     OpenGL support:              NO
--     VTK support:                 NO
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        build (ver encoder: 0x020e)
--     PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
--     TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 2.3.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
-- 
--   Video I/O:
--     DC1394:                      YES (2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                YES (3.7.0)
--     GStreamer:                   YES (1.14.5)
--     v4l/v4l2:                    YES (linux/videodev2.h)
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
-- 
--   NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
--     NVIDIA GPU arch:             53 62 72
--     NVIDIA PTX archs:
-- 
--   cuDNN:                         YES (ver 8.0.0)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/dlinano/Downloads/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.6.9)
--     Libraries:                   /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
--     numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
--     install path:                lib/python3.6/dist-packages/cv2/python-3.6
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dlinano/Downloads/opencv/build
tadam98 commented 3 years ago
make -j4 ``` [ 0%] Built target gen-pkgconfig [ 1%] Built target libjasper [ 5%] Built target libwebp [ 5%] Built target quirc [ 9%] Built target IlmImf [ 9%] Built target ittnotify [ 11%] Built target carotene_objs [ 12%] Built target ade [ 16%] Built target libprotobuf [ 16%] Built target opencv_videoio_plugins [ 16%] Built target gen_opencv_python_source [ 16%] Built target numeric [ 17%] Built target tegra_hal [ 17%] Built target opencv_cudev [ 18%] Built target multiview [ 18%] Built target correspondence [ 22%] Built target opencv_core [ 23%] Built target opencv_flann [ 23%] Built target opencv_hdf [ 24%] Built target opencv_surface_matching [ 25%] Built target opencv_ml [ 25%] Built target opencv_version [ 28%] Built target opencv_imgproc [ 28%] Built target opencv_plot [ 28%] Built target opencv_phase_unwrapping [ 29%] Built target opencv_cudaarithm [ 29%] Built target opencv_quality [ 30%] Built target opencv_reg [ 31%] Built target opencv_imgcodecs [ 32%] Built target opencv_cudawarping [ 32%] Built target opencv_freetype [ 32%] Built target opencv_fuzzy [ 33%] Built target opencv_features2d [ 33%] Built target opencv_img_hash [ 34%] Built target opencv_hfs [ 36%] Built target opencv_gapi [ 36%] Built target opencv_line_descriptor [ 37%] Built target opencv_saliency [ 41%] Built target opencv_dnn [ 41%] Built target opencv_text [ 43%] Built target opencv_calib3d [ 44%] Built target opencv_videoio [ 45%] Built target opencv_datasets [ 45%] Built target opencv_objdetect [ 45%] Built target opencv_cudastereo [ 47%] Built target opencv_cudafilters [ 47%] Built target opencv_shape [ 47%] Built target opencv_structured_light [ 48%] Built target opencv_rgbd [ 48%] Built target opencv_xobjdetect [ 48%] Built target opencv_video [ 49%] Built target opencv_aruco [ 49%] Built target opencv_highgui [ 50%] Built target opencv_cudacodec [ 50%] Built target opencv_dnn_superres [ 50%] Built target opencv_cudafeatures2d [ 50%] Built target example_rgbd_dynafu_demo [ 50%] Built target example_rgbd_kinfu_demo [ 50%] Built target example_rgbd_odometry_evaluation [ 50%] Built target example_rgbd_linemod [ 50%] Built target example_shape_shape_example [ 50%] Built target example_structured_light_cap_pattern [ 50%] Built target example_structured_light_pointcloud [ 52%] Built target opencv_cudaimgproc [ 52%] Built target example_structured_light_capsinpattern [ 52%] Built target example_structured_light_projectorcalibration [ 52%] Built target opencv_waldboost_detector [ 52%] Built target example_aruco_create_board_charuco [ 53%] Built target example_aruco_create_board [ 53%] Built target example_aruco_detect_board_charuco [ 53%] Built target example_aruco_detect_diamonds [ 53%] Built target example_aruco_calibrate_camera_charuco [ 53%] Built target example_aruco_calibrate_camera [ 54%] Built target opencv_xfeatures2d [ 54%] Built target example_aruco_create_diamond [ 56%] Built target opencv_ximgproc [ 56%] Built target example_aruco_create_marker [ 56%] Built target example_aruco_detect_board [ 56%] Built target example_aruco_detect_markers [ 56%] Built target opencv_bgsegm [ 56%] Built target opencv_ccalib [ 56%] Built target opencv_bioinspired [ 56%] Built target opencv_cudabgsegm [ 56%] Built target opencv_dnn_objdetect [ 57%] Built target opencv_dpm [ 58%] Built target opencv_cudalegacy [ 59%] Built target opencv_optflow [ 59%] Built target opencv_annotation [ 60%] Built target opencv_sfm [ 62%] Built target opencv_tracking [ 63%] Built target opencv_visualisation [ 63%] Built target example_dnn_text_detection [ 63%] Built target example_dnn_colorization [ 63%] Built target opencv_interactive-calibration [ 63%] Built target example_dnn_classification [ 63%] Built target example_dnn_object_detection [ 64%] Built target example_dnn_segmentation [ 64%] Built target example_dnn_openpose [ 64%] Built target example_tapi_clahe [ 64%] Built target example_tapi_hog [ 64%] Built target example_tapi_opencl_custom_kernel [ 64%] Built target example_tapi_camshift [ 64%] Built target example_tapi_bgfg_segm [ 64%] Built target example_tapi_dense_optical_flow [ 65%] Built target example_tapi_pyrlk_optical_flow [ 65%] Built target example_tapi_squares [ 65%] Built target example_tapi_ufacedetect [ 65%] Built target example_hdf_create_groups [ 65%] Built target example_hdf_create_read_write_datasets [ 65%] Built target example_hdf_read_write_attributes [ 65%] Built target example_phase_unwrapping_unwrap [ 66%] Built target example_quality_brisque_trainer_livedb [ 66%] Built target example_plot_plot_demo [ 66%] Built target example_quality_brisque_eval_tid2008 [ 66%] Built target example_reg_map_test [ 66%] Built target example_surface_matching_ppf_normal_computation [ 66%] Built target example_surface_matching_ppf_load_match [ 66%] Built target example_fuzzy_fuzzy_filtering [ 66%] Built target example_fuzzy_fuzzy_inpainting [ 66%] Built target example_gapi_draw_example [ 66%] Built target example_gapi_kernel_api_snippets [ 66%] Built target example_gapi_api_ref_snippets [ 66%] Built target example_gapi_slides_sobel_cv [ 66%] Built target example_gapi_slides_sobel_gapi [ 66%] Built target example_gapi_api_example [ 66%] Built target example_hfs_example [ 66%] Built target example_img_hash_hash_samples [ 66%] Built target example_line_descriptor_compute_descriptors [ 66%] Built target example_line_descriptor_lines_extraction [ 66%] Built target example_line_descriptor_radius_matching [ 66%] Built target example_line_descriptor_lsd_lines_extraction [ 67%] Built target example_line_descriptor_matching [ 67%] Built target example_line_descriptor_knn_matching [ 67%] Built target example_saliency_computeSaliency [ 67%] Built target example_text_text_recognition_cnn [ 67%] Built target example_text_cropped_word_recognition [ 67%] Built target example_text_end_to_end_recognition [ 68%] Built target opencv_photo [ 68%] Built target example_text_character_recognition [ 68%] Built target example_text_textdetection [ 68%] Built target example_text_textbox_demo [ 68%] Built target example_text_segmented_word_recognition [ 68%] Built target example_text_webcam_demo [ 68%] Built target example_text_dictnet_demo [ 68%] Built target example_datasets_is_weizmann [ 68%] Built target opencv_xphoto [ 68%] Built target example_datasets_gr_skig [ 68%] Built target example_datasets_ir_robot [ 68%] Built target example_datasets_msm_middlebury [ 69%] Built target example_datasets_fr_lfw_benchmark [ 69%] Built target example_datasets_fr_adience [ 69%] Built target example_datasets_ar_sports [ 69%] Built target example_datasets_hpe_parse [ 69%] Built target example_datasets_slam_kitti [ 69%] Built target example_datasets_track_vot [ 69%] Built target example_datasets_pd_inria [ 69%] Built target example_datasets_ar_hmdb_benchmark [ 69%] Built target example_datasets_msm_epfl [ 69%] Built target example_datasets_or_imagenet [ 69%] Built target example_datasets_gr_chalearn [ 70%] Built target example_datasets_or_mnist [ 70%] Built target example_datasets_sr_general100 [ 70%] Built target example_datasets_or_pascal [ 70%] Built target example_datasets_ir_affine [ 70%] Built target example_datasets_or_sun [ 71%] Built target example_datasets_tr_icdar [ 71%] Built target example_datasets_is_bsds [ 71%] Built target example_datasets_sr_bsds [ 71%] Built target example_datasets_sr_div2k [ 71%] Built target example_datasets_tr_chars [ 71%] Built target example_datasets_ar_hmdb [ 71%] Built target example_datasets_tr_chars_benchmark [ 71%] Built target example_datasets_fr_lfw [ 71%] Built target example_datasets_tr_icdar_benchmark [ 71%] Built target example_datasets_pd_caltech [ 71%] Built target example_datasets_tr_svt [ 71%] Built target example_datasets_hpe_humaneva [ 71%] Built target example_datasets_slam_tumindoor [ 71%] Built target example_datasets_tr_svt_benchmark [ 71%] Built target example_dnn_superres_dnn_superres_video [ 71%] Built target example_dnn_superres_dnn_superres_benchmark_quality [ 71%] Built target example_dnn_superres_dnn_superres [ 71%] Built target example_dnn_superres_dnn_superres_benchmark_time [ 71%] Built target example_xfeatures2d_shape_transformation [ 71%] Built target example_dnn_superres_dnn_superres_multioutput [ 71%] Built target example_xfeatures2d_gms_matcher [ 71%] Built target example_xfeatures2d_pct_signatures [ 71%] Built target example_xfeatures2d_pct_webcam [ 71%] Built target example_xfeatures2d_video_homography [ 71%] Built target example_xfeatures2d_bagofwords_classification [ 71%] Built target example_xfeatures2d_surf_matcher [ 71%] Built target example_ximgproc_thinning [ 71%] Built target example_ximgproc_selectivesearchsegmentation_demo [ 71%] Built target example_ximgproc_structured_edge_detection [ 71%] Built target example_ximgproc_seeds [ 72%] Built target example_ximgproc_run_length_morphology_demo [ 72%] Built target example_ximgproc_slic [ 72%] Built target example_ximgproc_peilin [ 72%] Built target example_ximgproc_deriche_demo [ 72%] Built target example_ximgproc_colorize [ 72%] Built target example_ximgproc_paillou_demo [ 72%] Built target example_ximgproc_edgeboxes_demo [ 72%] Built target example_ximgproc_color_match_template [ 73%] Built target example_ximgproc_disparity_filtering [ 73%] Built target example_ximgproc_niblack_thresholding [ 73%] Built target example_ximgproc_edgepreserving_filter_demo [ 73%] Built target example_ximgproc_fast_hough_transform [ 73%] Built target example_ximgproc_filterdemo [ 73%] Built target example_ximgproc_fld_lines [ 73%] Built target example_ximgproc_fourier_descriptors_demo [ 73%] Built target example_ximgproc_graphsegmentation_demo [ 73%] Built target example_ximgproc_brightedgesexample [ 73%] Built target example_ximgproc_live_demo [ 73%] Built target example_bgsegm_bgfg [ 73%] Built target example_bioinspired_retinaDemo [ 73%] Built target example_bioinspired_OpenEXRimages_HDR_Retina_toneMapping [ 73%] Built target example_ccalib_random_pattern_generator [ 74%] Built target example_ccalib_omni_calibration [ 74%] Built target example_ccalib_omni_stereo_calibration [ 74%] Built target example_ccalib_multi_cameras_calibration [ 74%] Built target example_ccalib_random_pattern_calibration [ 74%] Built target opencv_cudaobjdetect [ 74%] Built target example_dnn_objdetect_image_classification [ 74%] Built target example_dnn_objdetect_obj_detect [ 74%] Built target example_dpm_cascade_detect_camera [ 74%] Built target example_dpm_cascade_detect_sequence [ 74%] Built target example_optflow_optical_flow_evaluation [ 74%] Built target example_optflow_motempl [ 74%] Built target example_optflow_gpc_evaluate [ 74%] Built target opencv_face [ 74%] Built target example_optflow_pcaflow_demo [ 74%] Built target example_optflow_tvl1_optical_flow [ 74%] Built target example_optflow_gpc_train [ 74%] Built target example_optflow_simpleflow_demo [ 74%] Built target example_tracking_goturnTracker [ 74%] Built target example_tracking_kcf [ 74%] Built target example_tracking_csrt [ 75%] Built target example_tracking_benchmark [ 75%] Built target example_tracking_tracking_by_matching [ 75%] Built target example_tracking_multiTracker_dataset [ 76%] Built target opencv_stitching [ 76%] Built target example_tracking_multitracker [ 76%] Built target example_tracking_tracker [ 76%] Built target example_tracking_tracker_dataset [ 76%] Built target example_tracking_tutorial_customizing_cn_tracker [ 76%] Built target example_tracking_tutorial_introduction_to_tracker [ 76%] Built target example_tracking_tutorial_multitracker [ 76%] Built target example_xphoto_bm3d_image_denoising [ 76%] Built target opencv_stereo [ 77%] Built target opencv_cudaoptflow [ 77%] Built target example_xphoto_oil [ 77%] Built target example_xphoto_color_balance [ 77%] Built target example_xphoto_inpainting [ 78%] Built target example_xphoto_dct_image_denoising [ 78%] Built target example_face_samplewriteconfigfile [ 78%] Built target example_face_sample_train_landmark_detector2 [ 78%] Built target example_face_facerec_fisherfaces [ 78%] Built target example_face_facemark_lbf_fitting [ 78%] Built target example_face_facerec_save_load [ 78%] Built target example_face_facemark_demo_lbf [ 78%] Built target example_face_facerec_eigenfaces [ 79%] Built target example_face_facerec_demo [ 79%] Built target example_face_sampleDetectLandmarksvideo [ 79%] Built target example_face_sample_face_swapping [ 79%] Built target example_face_facemark_demo_aam [ 79%] Built target example_face_facerec_video [ 79%] Built target example_face_sampleDetectLandmarks [ 79%] Built target example_face_facerec_lbph [ 79%] Built target example_face_mace_webcam [ 79%] Built target example_cudaoptflow_nvidia_optical_flow [ 79%] Built target example_face_sample_train_landmark_detector [ 79%] Built target example_cudaoptflow_optical_flow [ 79%] Built target example_stereo_dense_disparity [ 79%] Built target example_stereo_export_param_file [ 79%] Built target example_stereo_sample [ 79%] Built target opencv_superres [ 79%] Built target example_gpu_video_writer [ 80%] Built target example_gpu_cascadeclassifier [ 80%] Built target opencv_videostab [ 80%] Built target example_gpu_farneback_optical_flow [ 80%] Built target example_gpu_bgfg_segm [ 80%] Built target example_gpu_pyrlk_optical_flow [ 80%] Built target example_gpu_hog [ 80%] Built target example_gpu_alpha_comp [ 80%] Built target example_gpu_stereo_match [ 80%] Built target example_gpu_houghlines [ 80%] Built target example_gpu_generalized_hough [ 80%] Built target example_gpu_morphology [ 80%] Built target example_gpu_multi [ 80%] Built target example_gpu_stereo_multi [ 80%] Built target example_gpu_surf_keypoint_matcher [ 80%] Built target example_gpu_super_resolution [ 81%] Built target example_gpu_video_reader [ 82%] Built target example_videostab_videostab [ 82%] Built target opencv_python3 [ 84%] Built target example_cpp_videocapture_starter [ 84%] Built target example_tutorial_pnp_registration [ 84%] Built target example_cpp_videocapture_intelperc [ 84%] Built target example_cpp_videocapture_gstreamer_pipeline [ 84%] Built target example_cpp_videocapture_gphoto2_autofocus [ 84%] Built target example_cpp_videocapture_basic [ 84%] Built target example_tutorial_LATCH_match [ 84%] Built target example_tutorial_video-input-psnr-ssim [ 84%] Built target example_tutorial_bg_sub [ 84%] Built target example_tutorial_meanshift [ 84%] Built target example_tutorial_imgproc_drawContours [ 84%] Built target example_tutorial_imgproc_calcHist [ 84%] Built target example_cpp_videowriter_basic [ 84%] Built target example_tutorial_imgproc_applyColorMap [ 84%] Built target example_tutorial_imgproc_HoughLinesPointSet [ 84%] Built target example_tutorial_BasicLinearTransformsTrackbar [ 84%] Built target example_cpp_train_svmsgd [ 85%] Built target example_cpp_stitching_detailed [ 85%] Built target example_cpp_squares [ 85%] Built target example_cpp_smiledetect [ 85%] Built target example_cpp_pca [ 85%] Built target example_tutorial_age_gender_emotion_recognition [ 85%] Built target example_tutorial_Remap_Demo [ 85%] Built target example_cpp_watershed [ 85%] Built target example_tutorial_calcBackProject_Demo1 [ 85%] Built target example_cpp_delaunay2 [ 85%] Built target example_cpp_stereo_match [ 85%] Built target example_cpp_segment_objects [ 85%] Built target example_tutorial_non_linear_svms [ 85%] Built target example_cpp_polar_transforms [ 85%] Built target example_tutorial_EqualizeHist_Demo [ 85%] Built target example_cpp_points_classifier [ 85%] Built target example_tutorial_Sobel_Demo [ 86%] Built target example_cpp_phase_corr [ 86%] Built target example_tutorial_calcBackProject_Demo2 [ 86%] Built target example_cpp_peopledetect [ 86%] Built target example_cpp_opencv_version [ 86%] Built target example_cpp_npr_demo [ 86%] Built target example_cpp_create_mask [ 86%] Built target example_cpp_minarea [ 86%] Built target example_cpp_matchmethod_orb_akaze_brisk [ 86%] Built target example_cpp_distrans [ 86%] Built target example_tutorial_Threshold [ 87%] Built target example_cpp_lkdemo [ 87%] Built target example_tutorial_Laplace_Demo [ 87%] Built target example_cpp_laplace [ 87%] Built target example_cpp_kalman [ 87%] Built target example_tutorial_decolor [ 87%] Built target example_cpp_intersectExample [ 87%] Built target example_tutorial_mat_the_basic_image_container [ 87%] Built target example_tutorial_video-write [ 87%] Built target example_cpp_inpaint [ 87%] Built target example_cpp_stitching [ 87%] Built target example_cpp_imagelist_reader [ 87%] Built target example_cpp_fback [ 87%] Built target example_cpp_select3dobj [ 87%] Built target example_cpp_cout_mat [ 87%] Built target example_cpp_neural_network [ 87%] Built target example_cpp_imagelist_creator [ 87%] Built target example_cpp_example [ 87%] Built target example_cpp_convexhull [ 87%] Built target example_tutorial_core_mat_checkVector [ 87%] Built target example_cpp_train_HOG [ 87%] Built target example_cpp_detect_blob [ 87%] Built target example_tutorial_face_beautification [ 87%] Built target example_cpp_mask_tmpl [ 87%] Built target example_cpp_logistic_regression [ 87%] Built target example_tutorial_gpu-basics-similarity [ 88%] Built target example_cpp_contours2 [ 88%] Built target example_tutorial_pose_from_homography [ 88%] Built target example_tutorial_core_reduce [ 88%] Built target example_cpp_connected_components [ 88%] Built target example_cpp_simd_basic [ 89%] Built target example_tutorial_optical_flow_dense [ 89%] Built target example_cpp_ffilldemo [ 89%] Built target example_tutorial_motion_deblur_filter [ 89%] Built target example_tutorial_periodic_noise_removing_filter [ 89%] Built target example_cpp_kmeans [ 89%] Built target example_tutorial_SURF_FLANN_matching_homography_Demo [ 89%] Built target example_cpp_demhist [ 89%] Built target example_cpp_application_trace [ 89%] Built target example_cpp_bgfg_segm [ 89%] Built target example_tutorial_cornerSubPix_Demo [ 89%] Built target example_cpp_grabcut [ 89%] Built target example_tutorial_documentation [ 90%] Built target example_cpp_dis_opticalflow [ 90%] Built target example_tutorial_imgproc_HoughLinesCircles [ 90%] Built target example_cpp_drawing [ 90%] Built target example_cpp_stereo_calib [ 90%] Built target example_tutorial_AddingImagesTrackbar [ 90%] Built target example_cpp_videocapture_openni [ 90%] Built target example_cpp_edge [ 90%] Built target example_cpp_falsecolor [ 90%] Built target example_cpp_dft [ 90%] Built target example_cpp_digits [ 90%] Built target example_cpp_morphology2 [ 90%] Built target example_cpp_ela [ 90%] Built target example_tutorial_changing_contrast_brightness_image [ 91%] Built target example_tutorial_filter2D_demo [ 91%] Built target example_tutorial_MatchTemplate_Demo [ 91%] Built target example_tutorial_Geometric_Transforms_Demo [ 91%] Built target example_cpp_detect_mser [ 91%] Built target example_tutorial_AddingImages [ 91%] Built target example_cpp_image_alignment [ 91%] Built target example_tutorial_camshift [ 91%] Built target example_tutorial_mat_operations [ 91%] Built target example_cpp_camshiftdemo [ 91%] Built target example_cpp_em [ 91%] Built target example_tutorial_optical_flow [ 91%] Built target example_tutorial_Morphology_1 [ 92%] Built target example_cpp_filestorage [ 92%] Built target example_cpp_facedetect [ 92%] Built target example_cpp_calibration [ 92%] Built target example_tutorial_calcHist_Demo [ 92%] Built target example_tutorial_compareHist_Demo [ 92%] Built target example_tutorial_HitMiss [ 92%] Built target example_tutorial_Morphology_2 [ 92%] Built target example_tutorial_Pyramids [ 92%] Built target example_tutorial_Smoothing [ 92%] Built target example_tutorial_imgproc_HoughLinesP [ 92%] Built target example_cpp_dbt_face_detection [ 93%] Built target example_tutorial_core_split [ 93%] Built target example_tutorial_anisotropic_image_segmentation [ 93%] Built target example_tutorial_Drawing_1 [ 93%] Built target example_cpp_warpPerspective_demo [ 93%] Built target example_tutorial_planar_tracking [ 93%] Built target example_tutorial_Morphology_3 [ 93%] Built target example_tutorial_pnp_detection [ 93%] Built target example_tutorial_mat_mask_operations [ 93%] Built target example_cpp_videocapture_camera [ 93%] Built target example_tutorial_copyMakeBorder_demo [ 93%] Built target example_tutorial_out_of_focus_deblur_filter [ 93%] Built target example_cpp_facial_features [ 93%] Built target example_tutorial_moments_demo [ 93%] Built target example_tutorial_CannyDetector_Demo [ 93%] Built target example_cpp_3calibration [ 93%] Built target example_tutorial_cornerDetector_Demo [ 94%] Built target example_tutorial_HoughCircle_Demo [ 94%] Built target example_cpp_fitellipse [ 94%] Built target example_cpp_letter_recog [ 94%] Built target example_tutorial_houghcircles [ 94%] Built target example_tutorial_houghlines [ 94%] Built target example_tutorial_imageSegmentation [ 94%] Built target example_tutorial_findContours_demo [ 94%] Built target example_tutorial_generalContours_demo1 [ 94%] Built target example_tutorial_perspective_correction [ 94%] Built target example_tutorial_generalContours_demo2 [ 94%] Built target example_cpp_tree_engine [ 94%] Built target example_tutorial_cornerHarris_Demo [ 94%] Built target example_tutorial_hull_demo [ 95%] Built target example_tutorial_camera_calibration [ 95%] Built target example_tutorial_compatibility_test [ 95%] Built target example_cpp_cloning_demo [ 95%] Built target example_tutorial_cloning_demo [ 95%] Built target example_tutorial_pointPolygonTest_demo [ 95%] Built target example_tutorial_discrete_fourier_transform [ 95%] Built target example_tutorial_how_to_scan_images [ 96%] Built target example_tutorial_how_to_use_OpenCV_parallel_for_ [ 96%] Built target example_tutorial_BasicLinearTransforms [ 97%] Built target example_tutorial_AKAZE_match [ 97%] Built target example_tutorial_decompose_homography [ 97%] Built target example_cpp_videocapture_image_sequence [ 97%] Built target example_cpp_qrcode [ 97%] Built target example_tutorial_Drawing_2 [ 97%] Built target example_tutorial_homography_from_camera_displacement [ 97%] Built target example_tutorial_file_input_output [ 97%] Built target example_tutorial_panorama_stitching_rotating_camera [ 97%] Built target example_tutorial_core_merge [ 98%] Built target example_tutorial_SURF_detection_Demo [ 98%] Built target example_tutorial_SURF_FLANN_matching_Demo [ 98%] Built target example_tutorial_porting_anisotropic_image_segmentation_gapi [ 98%] Built target example_tutorial_porting_anisotropic_image_segmentation_gapi_fluid [ 98%] Built target example_tutorial_security_barrier_camera [ 98%] Built target example_cpp_cloning_gui [ 98%] Built target example_tutorial_gdal-image [ 98%] Built target example_tutorial_SURF_matching_Demo [ 98%] Built target example_tutorial_hdr_imaging [ 98%] Built target example_cpp_travelsalesman [ 98%] Built target example_tutorial_display_image [ 98%] Built target example_tutorial_introduction_windows_vs [100%] Built target example_tutorial_introduction_to_svm [100%] Built target example_tutorial_introduction_to_pca [100%] Built target example_tutorial_Threshold_inRange [100%] Built target example_tutorial_objectDetection [100%] Built target example_tutorial_HoughLines_Demo [100%] Built target example_tutorial_npr_demo [100%] Built target example_tutorial_cloning_gui [100%] Built target example_tutorial_core_various [100%] Built target example_tutorial_goodFeaturesToTrack_Demo [100%] Built target example_tutorial_imgcodecs_imwrite ```
SaiSandeepKantareddy commented 3 years ago

@SaiSandeepKantareddy That's defnitely the problem. You need WITH_CUDA, WITH_CUDNN, WITH_CUBLAS and OPENCV_DNN_CUDA` set. Looking for lines that say "filtering out cuda4dnn source" in your CMake output. If you see this, it implies that the CUDA backend is not being built.

@tadam98 The assertion that is being triggered can only be triggered if the backend is set to DNN_BACKEND_OPENCV. If you're trying to use the GPU, the script should have set the backend to DNN_BACKEND_CUDA and that assertion shouldn't have been triggered at all.

Okay, so what's the answer for it and how should I do get rid of the error on jetson nano?

tadam98 commented 3 years ago

Hi,

I have these flags on my cmake command line. I do not see the filtering out in the above trace I provided.

Did I miss anything ?

WITH_CUDA, WITH_CUDNN, WITH_CUBLAS and OPENCV_DNN_CUDA` set. Looking for lines that say "filtering out cuda4dnn source" in your CMake output. If you see this, it implies that the CUDA backend is not being built.

tadam98 commented 3 years ago

This is my cmake run:

$ cmake \
 -D CMAKE_BUILD_TYPE=RELEASE \
 -D CMAKE_INSTALL_PREFIX=/usr/local \
 -D INSTALL_PYTHON_EXAMPLES=ON \
 -D WITH_CUDA=ON \
 -D WITH_CUDNN=ON \
 -D OPENCV_DNN_CUDA=ON \
 -D ENABLE_FAST_MATH=ON \
 -D CUDA_FAST_MATH=ON \
 -D CUDA_ARCH_PTX="" \
 -D CUDA_ARCH_BIN="5.3,6.2,7.2" \
 -D WITH_CUBLAS=ON \
 -D WITH_LIBV4L=ON \
 -D WITH_V4L=ON \
 -D WITH_QT=OFF \
 -D WITH_OPENGL=ON \
 -D BUILD_opencv_python3=ON \
 -D BUILD_opencv_python2=OFF \
 -D BUILD_opencv_java=OFF \
 -D WITH_FFMPEG=ON \
 -D WITH_GSTREAMER=ON \
 -D OPENCV_GENERATE_PKGCONFIG=ON \
 -D WITH_TBB=ON \
 -D BUILD_TBB=ON \
 -D WITH_GTK=ON \
 -D BUILD_TESTS=OFF \
 -D BUILD_PERF_TESTS=OFF \
 -D BUILD_EXAMPLES=ON \
 -D OPENCV_ENABLE_NONFREE=ON \
 -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
 ..
YashasSamaga commented 3 years ago

@tadam98 There are two conversations happening simultaneously in this issue. I am replying to two people. I don't know if you can see this in the mail.

@tadam98 Do this and report what happens (on Jetson Nano):

  1. export OPENCV_LOG_LEVEL=INFO and run the script in the same terminal. Report what you get on the terminal output.
  2. What arguments did you pass to the python script?

As I told earlier, the assertion that fails can only happen when DNN_BACKEND_OPENCV is being used. We need to figure out why it's happening.

@SaiSandeepKantareddy Do you also have cuDNN 8?

tadam98 commented 3 years ago

Hi,

Yes, cuDNN 8.0 is installed as part of NVIDIA Jetson JetPack DP 4.4. (DP=Developer pack). I have used sdkmanager in CLI mode to ensure my image is “by the book” and it is. (sdkmanager in gui mode does not come up with the Jetson Nano only with the Jetson Xavier)

cuDNN is installed and found by the OpenCV cmake. It is found after a modification to cmake\FindCUDNN.cmake file because in CUDA 10.2 the cudnn version is not anymore in cudnn.h but moved to cudnn_version.h. The is also a problematic SET command that is not generation the correct version code. I did not dive into it, just changed it to work.

extract version from the include

if(CUDNN_INCLUDE_DIR) file(READ "${CUDNN_INCLUDE_DIR}/cudnn_version.h" CUDNN_H_CONTENTS)

set(CUDNN_VERSION "${CUDNN_MAJOR_VERSION}.${CUDNN_MINOR_VERSION}.${CUDNN_PATCH_VERSION}")

CACHE

STRING

"cuDNN version"

)

Command line parameters (in a runme file): python3 ssd_object_detection.py \ --prototxt MobileNetSSD_deploy.prototxt \ --model MobileNetSSD_deploy.caffemodel \ --input guitar.mp4 --output output.avi \ --display 0 --use-gpu 1

Log level output: dlinano@dlinano:~/Downloads/pyimagesearch/opencv-dnn-gpu$ export OPENCV_LOG_LEVEL=INFO dlinano@dlinano:~/Downloads/pyimagesearch/opencv-dnn-gpu$ ./runme cv2 version= 4.2.0 cv2 path= /usr/local/lib/python3.6/dist-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so Traceback (most recent call last): File "ssd_object_detection.py", line 43, in net = cv2.dnn.readNetFromTensorflow(args["model"],args["prototxt"]) cv2.error: OpenCV(4.2.0) /home/dlinano/Downloads/opencv/modules/dnn/src/tensorflow/tf_io.cpp:42: error: (-2:Unspecified error) FAILED: ReadProtoFromBinaryFile(param_file, param). Failed to parse GraphDef file: MobileNetSSD_deploy.caffemodel in function 'ReadTFNetParamsFromBinaryFileOrDie'

dlinano@dlinano:~/Downloads/pyimagesearch/opencv-dnn-gpu$

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Yashas Samaga B Lmailto:notifications@github.com Sent: 28 May 2020 09:04 To: opencv/opencvmailto:opencv@noreply.github.com Cc: tadam98mailto:tadam_98@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

@tadam98https://github.com/tadam98 There are two conversations happening simultaneously in this issue. I am replying to two people. I don't know if you can see this in the mail.

@tadam98https://github.com/tadam98 Do this and report what happens (on Jetson Nano):

  1. export OPENCV_LOG_LEVEL=INFO and run the script in the same terminal. Report what you get on the terminal output.
  2. What arguments did you pass to the python script?

As I told earlier, the assertion that fails can only happen when DNN_BACKEND_OPENCV is being used. We need to figure out why it's happening.

@SaiSandeepKantareddyhttps://github.com/SaiSandeepKantareddy Do you also have cuDNN 8?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-635124913, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCTZ327BYVXPJUF4QTN3RTX5IBANCNFSM4KLW76EA.

tadam98 commented 3 years ago

I ran it again from the command line as the export may have not applied when I used the batch file.

dlinano@dlinano:~/Downloads/pyimagesearch/opencv-dnn-gpu$ python3 ssd_object_detection.py \
>   --prototxt MobileNetSSD_deploy.prototxt \
>   --model MobileNetSSD_deploy.caffemodel \
>   --input guitar.mp4 --output output.avi \
>   --display 0 --use-gpu 1
cv2 version= 4.2.0
cv2 path= /usr/local/lib/python3.6/dist-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so
Traceback (most recent call last):
  File "ssd_object_detection.py", line 43, in <module>
    net = cv2.dnn.readNetFromTensorflow(args["model"],args["prototxt"])
cv2.error: OpenCV(4.2.0) /home/dlinano/Downloads/opencv/modules/dnn/src/tensorflow/tf_io.cpp:42: error: (-2:Unspecified error) FAILED: ReadProtoFromBinaryFile(param_file, param). Failed to parse GraphDef file: MobileNetSSD_deploy.caffemodel in function 'ReadTFNetParamsFromBinaryFileOrDie'

dlinano@dlinano:~/Downloads/pyimagesearch/opencv-dnn-gpu$
SaiSandeepKantareddy commented 3 years ago

@tadam98 There are two conversations happening simultaneously in this issue. I am replying to two people. I don't know if you can see this in the mail.

@tadam98 Do this and report what happens (on Jetson Nano):

1. export `OPENCV_LOG_LEVEL=INFO` and run the script in the same terminal. Report what you get on the terminal output.

2. What arguments did you pass to the python script?

As I told earlier, the assertion that fails can only happen when DNN_BACKEND_OPENCV is being used. We need to figure out why it's happening.

@SaiSandeepKantareddy Do you also have cuDNN 8?

I have installed Jetson pack 4.4 and it says it contains cuDNN but I am not able to find, I think @tadam98 has rightly pointed about the error in his previous comments about cudnn_version.h

tadam98 commented 3 years ago

Correct. You must change OpenCV/cmake/FindCUDNN.cmake as I described in earlier posts. The corrections are needed because NVIDIA changed the location of the header files in cuda 10.2 which is part of Jetpack DP4.4.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: SaiSandeepKantareddymailto:notifications@github.com Sent: 28 May 2020 15:36 To: opencv/opencvmailto:opencv@noreply.github.com Cc: tadam98mailto:tadam_98@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [opencv/opencv] Compiling Opencv 4.2.0 + CUDA on jetson nano board (#16439)

@tadam98https://github.com/tadam98 There are two conversations happening simultaneously in this issue. I am replying to two people. I don't know if you can see this in the mail.

@tadam98https://github.com/tadam98 Do this and report what happens (on Jetson Nano):

  1. export OPENCV_LOG_LEVEL=INFO and run the script in the same terminal. Report what you get on the terminal output.

  2. What arguments did you pass to the python script?

As I told earlier, the assertion that fails can only happen when DNN_BACKEND_OPENCV is being used. We need to figure out why it's happening.

@SaiSandeepKantareddyhttps://github.com/SaiSandeepKantareddy Do you also have cuDNN 8?

I have installed Jetson pack 4.4 and it says it contains cuDNN but I am not able to find, I think @tadam98https://github.com/tadam98 has rightly pointed about the error in his previous comments about cudnn_version.h

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencv/opencv/issues/16439#issuecomment-635323151, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBMCT7OO23XRR7MIKN74UDRTZLELANCNFSM4KLW76EA.

YashasSamaga commented 3 years ago

@SaiSandeepKantareddy Please have a look at #17238. NVIDIA hasn't released the documentation or release notes for cuDNN 8. We don't know for sure how exactly the new cuDNN 8 structures the headers and binaries. The fix might be a bit more complicated based on the comments in the aforementioned PR.

SaiSandeepKantareddy commented 3 years ago

Actually, it is working on jetson pack 4.3

On Thu, 28 May 2020, 18:49 Yashas Samaga B L, notifications@github.com wrote:

@SaiSandeepKantareddy https://github.com/SaiSandeepKantareddy Please have a look at #17238 https://github.com/opencv/opencv/pull/17238. NVIDIA hasn't released the documentation or release notes for cuDNN 8. We don't know for sure how exactly the new cuDNN 8 structures the headers and binaries. The fix might be a bit more complicated based on the comments in the aforementioned PR.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opencv/opencv/issues/16439#issuecomment-635345054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3UKTK5IBCJUOENY7RQ3ILRTZQGNANCNFSM4KLW76EA .

tadam98 commented 3 years ago

Hi,

I can confirm a successful compilation of OpenCV 4.2.0 with CUDA (10.0) and cuDNN (7.6.3) that come with JetPack 4.3 with my software. Backend support is there and working.

NVIDIA - do something about Jetpack DP4.4 and libcudnn.so.8 and also put OpenCV 4.2.0 rather than old versions compiled without any cuda or cudnn support.

cike0cop commented 3 years ago

Hi, I have a question about opencv dnn use cuda for forward. image image image

ddwnbe commented 3 years ago

Hey YashasSamaga

I've tried running your script, on the latest Jetson Nano .img release with JP4.4.1, and I am getting an error regarding openGL, saying that it is deprecated. I am not quite sure how to pull that part out of your script.

Best regards ddwnbe

YashasSamaga commented 3 years ago

@ddwnbe

  1. comment or remove -D WITH_OPENGL=ON
  2. comment or remove sudo patch -N cuda_gl_interop.h $WHEREAMI'/patches/OpenGLHeader.patch'
ddwnbe commented 3 years ago

@YashasSamaga Thanks for you reply, it worked. I apparently removed a line too much of the script, when I initially ran it with those two lines removed