NickSwardh / YoloDotNet

YoloDotNet - A C# .NET 8.0 project for Classification, Object Detection, OBB Detection, Segmentation and Pose Estimation in both images and videos.
GNU General Public License v3.0
129 stars 22 forks source link

Library crashing with fatal & system.accessviolation corrupt memory when running on gpu? #13

Open aloksharma1 opened 1 month ago

aloksharma1 commented 1 month ago

Hello,

in your code, you are using imagesharp directly but i need to perform some custom operations on my video feed for advance detection and drawing. Can you provide a sample code for that, i want to:

  1. filter based on label (so only cars or bikes are boxed in the feed)
  2. get instance segmentation and recolor objects based on filtering

thanks

aloksharma1 commented 1 month ago

i figured it out, the problem is that my model is not running on gpu and crashing with fatal error or access violation errors. i am using cuda toolkit 11.8 & cuDNN as provided in your readme but still getting this issue. i tried with different cuDNN 8.5, 8.7, 8.9 same issue please help.

my specs are : rtx 4080 super 16 GB i9-14900K 128 GB DDR5 RAM

what is the correct version for me?

NickSwardh commented 1 month ago

Hi aloksharma1, did you drop the cuDNN dll's in your CUDA-bin folder and update your System Variable (PATH) to include the dir-location to your CUDA-bin folder as well? In case you missed it, check my CUDA and cuDNN installation guide here: https://www.youtube.com/watch?v=KC9-9L7FgPc

CUDA version to use:

aloksharma1 commented 1 month ago

Hi aloksharma1, did you drop the cuDNN dll's in your CUDA-bin folder and update your System Variable (PATH) to include the dir-location to your CUDA-bin folder as well? In case you missed it, check my CUDA and cuDNN installation guide here: https://www.youtube.com/watch?v=KC9-9L7FgPc

CUDA version to use:

  • CUDA v11.8
  • cuDNN 8.9.7 (for CUDA v11.x)

Yes, already done that, tried different versions of cuDNN from 8.5 to 8.9 too to see if that could have been the problem. The issue stays , my app starts processing with yolo and crashes randomly (only on gpu).

aloksharma1 commented 1 month ago

Here is some more details, i modified your library sample to use gpu and ran a iteration after 1-3 it randomly crashed with these errors apart from access violation its always something different:

System.ExecutionEngineException
  HResult=0x80131506
  Message=Exception of type 'System.ExecutionEngineException' was thrown.

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Memory`1.get_Span() in /_/src/libraries/System.Private.CoreLib/src/System/Memory.cs:line 350

here is the code change:

foreach (int number in Enumerable.Range(1, 10))
    runDemoAction("yolov8s-seg.onnx", "car2.png", true, true);