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

I am working with Object Detection ( training with YOLOv3) on Jetson Orin with OpenCV
My Objective: get the CUDA working for the object detection.

**OpenCV = 4.5.4**
**Operating System / Platform => NVIDIA JETSON Orin (Tegra)**
**Compiler => Visual Studio 2019*
**CUDNN 8.6 and CUDA 11.4.**

I have configured the opencv with cmake-gui, enabling,

WITH_CUDNN=ON
OPENCV_DNN_CUDA=ON
ENABLE_FAST_MATH=1
CUDA_FAST_MATH=1
CUDA_ARCH_BIN=8.7
WITH_CUBLAS=1
WITH_CUDA=ON
BUILD_OPENCV_DNN=ON
BUILD_OPENCV_WORLD=ON
OPENCV_EXTRA_MODULES=/path/opencv_contrib/modules
PYTHON3_EXECUTABLES=/path/
PYTHON3_INCLUDE_DIR=/path/
PYTHON3_LIB=/path/
PYTHON3_PATH=/path/
PYTHON3_NUMPY=/path/
CUDNN_VERSION=8.6.0

i also linked ln -s /usr/local/lib/python3/dist-packages/cv2/python-3.8/cv2.cpython-38-aarch64-linux-gnu.so cv2.so

The opencv test : import cv2 also works.

cv2.version
4.5.4

And I use this segment in my code.

cout << “Using GPU device” << endl;
net.setPreferableBackend(DNN_BACKEND_CUDA);
net.setPreferableTarget(DNN_TARGET_CUDA);

And i use, my own tested,
.cfg,
.weights
data.names
test.png (these work perfectly in around 72 milliseconds from the direct command line)

When run, i do get the image output with the objects detected, But the problem is
: it switches to CPU and compiles giving the result in 400 milliseconds.

The issue is displayed as below:

[ WARN:0] global /home/ubuntu/build_opencv/opencv/modules/dnn/src/dnn.cpp (1447) setUpNet DNN module was not built with CUDA backend; switching to CPU

But, the dnn.cpp is in the path: tk_ws/opencv-4.5.4/modules/dnn/src/dnn.cpp
My directory structure is ( i cloned the opencv into my tk_ws workspace)

tk_ws/opencv-4.5.4/build
tk_ws/opencv_contrib-4.5.4

while as per the instructions on GSoC 2019 | OpenCV | Adding a CUDA backend to the DNN module · GitHub

I can see the opencv_test_dnn in green.

I could not figure out why I am repeatedly failing. with the backend switching automatically to CPU instead of CUDA every time

I would be immensely grateful if you could help me, please.

Warm Regards,
Karishma

When you configure with CMake does it pick up cuDNN? i.e. Do you see something similar to the below?

--   NVIDIA CUDA:                   YES (ver 11.7, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
--     NVIDIA GPU arch:             86
--     NVIDIA PTX archs:
--
--   cuDNN:                         YES (ver 8.4.1)

Yes I do. it configures to my CUDNN - 8.6.0 version, every time.
2022-11-17 07_49_10-Window