1

I am using Alturos.YOLO with Emgu CV 3.2 (World.dll) in a C# WPF Application. I am testing this app on an 8GB RAM. But, it is VERY slow. I don't know what seems to be the problem. Here is my code:

private void Timer_Tick(object sender, EventArgs e)
{
    var img = capture.QueryFrame();
    videoViewer.Source = ToBitmapSource(img);
    var memoryStream = new MemoryStream();
    img.Bitmap.Save(memoryStream, ImageFormat.Png);
    var _items = yolo.Detect(memoryStream.ToArray()).ToList();
    var graphics = Graphics.FromImage(img.Bitmap);
    var brush = new SolidBrush(Color.LightGreen);

    foreach (var item in _items)
    {
        var x = item.X;
        var y = item.Y;
        var width = item.Width;
        var height = item.Height;
        var type = item.Type;  // class name of the object
        var rect = new Rectangle(x, y, width, height);
        var pen = new Pen(Color.LightGreen, 6);
        var point = new System.Drawing.Point(x + width / 2, y + height / 2);
        graphics.DrawRectangle(pen, rect);
        graphics.DrawString($"{item.Type} : {item.Height} * {item.Width}", new Font("Arial", 23f), brush, point);
        MessageBox.Show(type);
    }
}
AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52

1 Answers1

0

You can try one of two things, or both, either reducing the number of classes in your YOLO database to the objects you target only, here is some details, or try to use GPU to accelerate detection using CUDA C++, but you must own a NVidia card. These two methods worked for me and reduced detection time greatly.

AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52