dme-compunet / YoloV8

Integrate YOLOv8 into your C# project for a variety of real-time tasks including object detection, instance segmentation, pose estimation and more, using ONNX Runtime.
https://www.nuget.org/packages/YoloV8
GNU Affero General Public License v3.0
249 stars 48 forks source link

still high memory usage and consuption #73

Open areytechai opened 5 days ago

areytechai commented 5 days ago

Screenshot_38 Screenshot_39

Title: High Memory Usage in PredictorPlottingExtensions Class

Description: I’m experiencing significant memory usage when using the PredictorPlottingExtensions class in the YOLOv8 project. During image processing, memory consumption increases rapidly, leading to performance issues, especially with large images.

Steps to Reproduce:

Use methods like PoseAndSave, DetectAndSave, DetectObbAndSave, SegmentAndSave, or ClassifyAndSave for image processing and saving. Observe memory usage as the application runs. Expected Behavior: Memory consumption should remain stable and efficient during image processing and saving.

Actual Behavior: Memory usage increases significantly and doesn't seem to be released, potentially indicating a memory leak or inefficient memory management.

areytechai commented 5 days ago

[]single i couldnt stop Single[] 99 457184344 457184344

dme-compunet commented 4 days ago

It was fixed in version 5.0.2, which version are you using?

areytechai commented 4 days ago

It was fixed in version 5.0.2, which version are you using?

The latest version, 5.04,

image after a while

image

private static string CreateImageOutputPath(string path, YoloTask task) { var baseDirectory = Path.GetDirectoryName(path) ?? Environment.CurrentDirectory;

  var plotDirectory = Path.Combine(baseDirectory, task.ToString().ToLower());

  if (Directory.Exists(plotDirectory) == false)
  {
      Directory.CreateDirectory(plotDirectory);
  }

  var extn = Path.GetExtension(path);
  var name = Path.GetFileNameWithoutExtension(path);

  var index = 0;

  while (true)
  {
      var filename = index == 0 ? $"{name}{extn}" : $"{name}_{index}{extn}";
      var fullpath = Path.Combine(plotDirectory, filename);
      return fullpath;

      //if (File.Exists(fullpath))
      //{
      //    index++;
      //}
      //else
      //{
      //    return fullpath;
      //}
  }

}

i try to replace alltime with same file isit cause of it?

single[] is extremly high

areytechai commented 4 days ago

image

image

the single[] class unstopable

image

dme-compunet commented 3 days ago

According to the memory graph it seems that there is no leak, but the memory is quite high, and this is possible if you load a large model or several models at the same time, How much does the model you use weigh?

areytechai commented 3 days ago

just one image progressing, in 3-4 seconds only segmentation, i just make timer, after 60 minutes restart apps and free the memmory,

any alternative way to clear single[] ?