如何在 C#.net 中使用 YOLO 提高物体检测速度

How to increase the speed of object detection using YOLO in C#.net

我想通过 YOLO V3 检测车牌区域。为此,我使用暗网创建权重。 训练后创建了一个权重文件。该文件的大小为 234 MB,我使用了 darknet53.conv.74 文件和 650 张图像进行训练。

配置文件(yolov3.cfg)是

# Testing
# batch=64
# subdivisions=8
# Training
batch=64
subdivisions=64
width=608
height=608
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

learning_rate=0.001
burn_in=1000
max_batches = 4000
policy=steps
steps=3200,3600
scales=.1,.1
....

之后我在 C#.NET 中使用 Alturos.Yolo 2.6.2 NuGet

YoloWrapper yoloWrapper;
private void Form_Load(object sender, EventArgs e)
{
   yoloWrapper = new YoloWrapper("yolov3.cfg", "yolov3.weights", "voc.names");
}

private void btnDetect_Click(object sender, EventArgs e)
{
   var items = yoloWrapper.Detect(path);
   ...
}

问题是速度。检测车牌区域大约需要 3 秒。

你们有什么提高检测速度的方案吗?

由于您自己训练过,我想您已经知道神经网络需要 GPU 才能 运行 更快。无论如何,为了更快地检测,您应该降低网络分辨率或使用 YOLO 的微小变体。今天,这里介绍了最强最快的变体:yolo_v3_tiny_pan3.cfg. Others most recent darknet models are available here。一些其他网络,如 mobilenet,经过优化,可以在 CPU.

上更快地运行

无论如何,这些替代网络需要 AlexeyAB 暗网实现才能工作,因此您需要重新编译 c# 包装器的暗网。

我们还使用了一个微型版本的 yolo 来检测托盘: https://www.sydesoft.de/kuenstliche-intelligenz.html

这适用于 cpu 一秒钟。