【问题标题】:How to improve Alturos.YOLO performance on webcam?如何提高 Alturos.YOLO 在网络摄像头上的性能?
【发布时间】:2020-08-08 11:20:59
【问题描述】:

我在 C# WPF 应用程序中使用 Alturos.YOLO 和 Emgu CV 3.2 (World.dll)。我正在 8GB RAM 上测试这个应用程序。但是,它非常慢。我不知道似乎是什么问题。这是我的代码:

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);
    }
}

【问题讨论】:

    标签: c# wpf emgucv yolo


    【解决方案1】:

    您可以尝试以下两种方法中的一种,或者同时尝试两种方法,或者将 YOLO 数据库中的类数量减少到仅针对您的目标对象,here 是一些细节,或者尝试使用 GPU 来加速检测,使用 CUDA C++ ,但您必须拥有 NVidia 卡。这两种方法对我有用,大大减少了检测时间。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-30
      • 1970-01-01
      • 2022-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-28
      • 1970-01-01
      相关资源
      最近更新 更多