Repository: opencv
Issue: Caught an exception trying to run inference:
Labels: question (invalid tracker)

### System Information

OpenCV版本：4.5.4
作業系統/平台：Ubuntu 22.04
編譯器&編譯器版本：GCC 9.5.0

### Detailed description

Hello
       I want to perform COCO dataset objects detection using yolov8
test, but the following two problems occurred during execution
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Caught an exception trying to run inference:
OpenCV(4.5.4) ./modules/dnn/include/opencv2/dnn/shape_utils.hpp:170: error: (-215:Assertion failed) start <= (int)shape.size() && end <= (int )shape.size() && start <= end in function 'total'


Cuda and/or GPU driver might not be correctly installed. Setting preferable backend to CPU and trying again.
terminate called after throwing an instance of 'cv::Exception'
  what(): OpenCV(4.5.4) ./modules/dnn/include/opencv2/dnn/shape_utils.hpp:170: error: (-215:Assertion failed) start <= (int)shape.size() && end <= (int)shape.size() && start <= end in function 'total'

Aborted (core dumped)

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
I can't solve the first problem, and I want to use the OpenCV GPU version to do the second one. I would like to ask how I can solve the above problems.

please help me solve the problem thank you all

### Steps to reproduce

mk@mk-ROG-Flow-X16-GV601VI-GV601VI:~/visp-ws/visp-build/tutorial/detection/dnn$ DNN_PATH=/home/mk/visp-ws/visp-build/tutorial/detection/dnn \
  CONFIG=none \
  MODEL=${DNN_PATH}/yolov8/yolov8s.onnx \
  LABELS=${DNN_PATH}/coco_classes.txt \
  TYPE=yolov8 \
  FRAMEWORK=onnx \
  WIDTH=640 HEIGHT=480
mk@mk-ROG-Flow-X16-GV601VI-GV601VI:~/visp-ws/visp-build/tutorial/detection/dnn$ ./tutorial-dnn-object-detection-live --model $MODEL --labels $LABELS --config $CONFIG --type $TYPE \
    --framework $FRAMEWORK --width $WIDTH --height $HEIGHT --nmsThresh 0.5 --mean 0 0 0 \
    --filterThresh -0.25 --scale 0.0039
Video device         : 0
Label file (optional): /home/mk/visp-ws/visp-build/tutorial/detection/dnn/coco_classes.txt
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
[vpDetectorDNNOpenCV::setParsingMethod] NB: scale factor changed to 1/255. to normalize pixels value.
Model                : /home/mk/visp-ws/visp-build/tutorial/detection/dnn/yolov8/yolov8s.onnx
Type                 : yolov8
Config     (optional): "None"
Framework  (optional): onnx
Width x Height       : 640 x 480
Mean RGB             : 0.000000 0.000000 0.000000
Scale                : 0.003922
Swap RB?             : false
Confidence threshold : 0.500000
NMS threshold        : 0.500000
Filter threshold     : disabled

Caught an exception trying to run inference:
	OpenCV(4.5.4) ./modules/dnn/include/opencv2/dnn/shape_utils.hpp:170: error: (-215:Assertion failed) start <= (int)shape.size() && end <= (int)shape.size() && start <= end in function 'total'

Cuda and/or GPU driver might not be correctly installed. Setting preferable backend to CPU and trying again.
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.4) ./modules/dnn/include/opencv2/dnn/shape_utils.hpp:170: error: (-215:Assertion failed) start <= (int)shape.size() && end <= (int)shape.size() && start <= end in function 'total'

Aborted (core dumped)


### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [ ] I updated to the latest OpenCV version and the issue is still there
- [ ] There is reproducer code and related data files (videos, images, onnx, etc)