AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.63k stars 7.95k forks source link

"no kernel image is available for execution on the device" when running detection on images #8179

Open twardmat opened 2 years ago

twardmat commented 2 years ago

So basically I set up the environment for object detection and it was going fine till starting the image recognition script. Problem occurs when path to image is given to console, first part of command (darknet.exe detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights) works fine. Than the path to the image is given and console pop out the error communicate

"CUDA status Error: file: D:/YOLOv4/darknet/src/blas_kernels.cu : add_bias_gpu() : line: 121 : build time: Oct 26 2021 - 18:30:58

CUDA Error: no kernel image is available for execution on the device

Darknet error location: D:\YOLOv4\darknet\src\dark_cuda.c, check_error, line #69 CUDA Error: no kernel image is available for execution on the device: No error"

I have on Windows python 3.7.7, openCV 4.5.4, CUDA 10.2.89, cuDNN 8.2.2

Nvidia image

The error looks like that

Error

cenit commented 2 years ago

how did you build your darknet version?

twardmat commented 2 years ago

I opened darknet.sln in VS2019 then included openCV into C/C++ additional include directory, deleted Preprocessor definition CUDNN_HALF, changed code generation in CUDA settings to include only sm_35 and compute_35 (later changed it to 37) and added OpenCV path to linker directories. After that i built the whole file

cenit commented 2 years ago

try with

./build.ps1 -UseVCPKG -EnableOpenCV -EnableCUDA -EnableCUDNN -AdditionalBuildSetup "-DCMAKE_CUDA_ARCHITECTURES=37"
twardmat commented 2 years ago

The first run i was prompted that CMake was too old (i had 3.17 installed, ps required 3.18 or higher). I have updated the Cmake to 3.22. Second run i was prompted with some kind of error suggesting that vcpkg might be too old and needs update. Updated. Third and the following script stopped at building ffmpg:x64. No error, no response. Once i managed to get this error. image

cenit commented 2 years ago

try to reboot your computer and relaunch the script

cenit commented 2 years ago

a file is locked, which means that a program running from a previous test was not fully killed

twardmat commented 2 years ago

This was why the program stopped, although it is not the root of the problem. Running build on clean repo gives me results below. 1 image

I may have found the source of the problem, I will check it later on. Is it possible that changing cuda version in YOLO_cpp_dll.vcxproj and not changing it in darknet.vcxproj is causing the error?

cenit commented 2 years ago

nope, those files are not used at all

please attach files D:\yolov4\darknet\vcpkg\buildtrees\ffmpeg\build-x64-windows-rel-*.log

twardmat commented 2 years ago

build-x64-windows-rel-err.log build-x64-windows-rel-out.log