BobLd / YOLOv4MLNet

Use the YOLO v4 and v5 (ONNX) models for object detection in C# using ML.Net
MIT License
79 stars 31 forks source link

Speed To Detect very SLOW #8

Closed hohoangan closed 2 years ago

hohoangan commented 3 years ago

First, Thank you for your source, It has helped me a lot. But speed to detect the object in an image is slow, How can faster do it such as use GPU or custom list object, Because I need counting vehicle from the camera. Please help!

orielswisa commented 3 years ago

+1

Transigent commented 3 years ago

This has GPU support: https://github.com/wang-xinyu/tensorrtx Some benchmarks at the page end.

BobLd commented 3 years ago

Hi,

There is already an open issue about that here: https://github.com/dotnet/machinelearning/issues/5597 Unfortunatly, and as explained here, this doesn't come from this code but from the ML.Net/Onnx step.

You can use the GPU. If I remember well you will need to use the following package: https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime.Gpu/ I did some tests in the past and it worked, but you might have error messages that are linked to nuget packages conflicts. You will need to uninstall the cpu package.

BobLd commented 3 years ago

Try updating to NL.Net v1.6.0, they have improved image handling and it's much faster. I've updated the repos with https://github.com/BobLd/YOLOv4MLNet/commit/5cab380bf969a03ed33b9e5569746e844ade4ef7

orielswisa commented 3 years ago

Hi,

There is already an open issue about that here: dotnet/machinelearning#5597 Unfortunatly, and as explained here, this doesn't come from this code but from the ML.Net/Onnx step.

You can use the GPU. If I remember well you will need to use the following package: https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime.Gpu/ I did some tests in the past and it worked, but you might have error messages that are linked to nuget packages conflicts. You will need to uninstall the cpu package.

Hi,

I have nvidia rtx 2080 super i haved try to do that in past but it not work for me, Are you know which CUDA and cuDNN version i need?

BobLd commented 3 years ago

From this recent article, I see that they use

But I haven't tried yet

orielswisa commented 3 years ago

Tnx for your answer! The Model Builder recognized the GPU but how can it help me with your code?

Eclipi commented 2 years ago

I found that the inference speed is a lot faster on .Net Core 5.0 w/o GPU. It took around ~8000ms on .NET Framework 4.7.2 and ~600s on Core.