ivilson / Yolov7net

Yolo Detector for .Net 8
83 stars 25 forks source link

Exception useCuda = true #6

Closed nckoff closed 2 months ago

nckoff commented 1 year ago

If i choose useCuda = True

Microsoft.ML.OnnxRuntime 1.11.0: 0688_688_2022_12_10_Vision_v1pMV1d0Af

I thought I needed Microsoft.ML.OnnxRuntime.Gpu Microsoft.ML.OnnxRuntime.Gpu 1.11.0: 0689_689_2022_12_10_Vision_GtZk2jFSA8

Microsoft.ML.OnnxRuntime.Gpu 1.13.1: 0690_690_2022_12_10_Vision_TlLTUM39Vu

I tried on different devices Windows 10/11 Please, help.

mikelmujika11 commented 1 year ago

Hi @nckoff,

Have you solved the issue? Because I am facing the same problem.

Thanks,

iwaitu commented 1 year ago

Have you installed the cuda library on your Windows platform and successfully run the Nvidia sample code?

mikelmujika11 commented 1 year ago

Hi @iwaitu,

I installed cuda from this link: https://developer.nvidia.com/cuda-downloads. Where can I found the Nvidia sample code?

Thanks,

iwaitu commented 1 year ago

https://www.youtube.com/watch?v=cL05xtTocmY

mikelmujika11 commented 1 year ago

I have followed the video and I have run the examples correctly, but the program still gives me the same error.

iwaitu commented 1 year ago

Where the weight file come from? Maybe you should try to export your own onnx file by use your custom pt file.

mikelmujika11 commented 1 year ago

Hi @iwaitu ,

The weights are custom weights. I have obtained a .pt first and transformed to .onnx to use it with c#. The problem is that set useCuda = False the program works. But it uses the CPU so it is really slow. That's why I want to use the GPU, setting the useCuda = True, but it gives me the error.

iwaitu commented 1 year ago

the problem is your export params, before you export your onnx file,you should try this:

model.cuda()
mode.eval()
zzzdddyyy commented 1 year ago

Have you downloaded and configured cuDNN?

AVISIX commented 1 year ago

If i choose useCuda = True

Microsoft.ML.OnnxRuntime 1.11.0: 0688_688_2022_12_10_Vision_v1pMV1d0Af

I thought I needed Microsoft.ML.OnnxRuntime.Gpu Microsoft.ML.OnnxRuntime.Gpu 1.11.0: 0689_689_2022_12_10_Vision_GtZk2jFSA8

Microsoft.ML.OnnxRuntime.Gpu 1.13.1: 0690_690_2022_12_10_Vision_TlLTUM39Vu

I tried on different devices Windows 10/11 Please, help.

Hey there, I had the exact same issue. This is because you either don't have CUDA and CudNN not installed or the PATH environment variable doesn't have the paths of the CUDA and CudNN binaries.

I have manually added the required files to my project. For me it looks like this: image

Depending on the version, you might need different files.

iwaitu commented 3 months ago

If you have successfully exported the ONNX file and correctly installed CUDA and cuDNN, then you need to add Microsoft.ML.OnnxRuntime.Gpu to your project.