Ana*_*mov 4 ocr machine-learning svm object-detection dlib
我正在尝试使用dlib机器学习库进行对象检测.
正如我按照指示编写的一切似乎都没问题,但即使在原始图像上也无法检测到我的对象.即使我在一个唯一的黑色图像上测试它,它也会发现一次检测.哪个不应该发生.如果我将一个经过训练的图像粘贴到黑色图像上,它会发现许多不应该发生的检测.
我没有碰到train_object_detector.cpp文件.它是原创的.
这是我的样本图片





我使用imglab创建的XML文件.
<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='image_metadata_stylesheet.xsl'?>
<dataset>
<name>imglab dataset</name>
<comment>Created by imglab tool.</comment>
<images>
<image file='totaldata/1.jpg'>
<box top='0' left='1' width='61' height='64'/>
</image>
<image file='totaldata/2.jpg'>
<box top='0' left='1' width='63' height='65'>
<label>1</label>
</box>
</image>
<image file='totaldata/3.jpg'>
<box top='1' left='0' width='61' height='61'>
<label>1</label>
</box>
</image>
<image file='totaldata/4.jpg'>
<box top='0' left='0' width='59' height='63'>
<label>1</label>
</box>
</image>
<image file='totaldata/5.jpg'>
<box top='2' left='1' width='59' height='60'>
<label>1</label>
</box>
</image>
<image file='totaldata/6.jpg'>
<box top='0' left='2' width='60' height='62'>
<label>1</label>
</box>
</image>
</images>
</dataset>
Run Code Online (Sandbox Code Playgroud)
只有黑色的检测截图

只有黑色和一个训练过的图像的检测截图.

以防万一这是cpp文件的链接.
http://dlib.net/train_object_detector.cpp.html
先感谢您.
你不应该裁剪你的训练图像.您需要提供看起来像您将在测试时使用的图像的训练图像.
在这种情况下,图像窗口的部分特征向量是从图像外部的区域中提取的(因为您的对象被如此紧密地裁剪)并且由于图像的外部被假定为黑色,因此了解到对象始终被包围黑色像素.