使用Dlib库进行对象检测

我正在尝试使用dlib机器学习库进行对象检测。

虽然我按照说明操作,一切看似正常,但我无法在原始图像上检测到我的对象。即使我在纯黑图像上测试,它也会检测到一个对象,这是不应该发生的。此外,如果我将一张训练过的图像粘贴到黑色的图像上,它会检测到很多对象,这同样不应该发生。

我没有修改train_object_detector.cpp文件,它是原始的。

这是我的样本图像

enter image description hereenter image description here enter image description hereenter image description hereenter image description hereenter image description here

我使用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>

纯黑图像检测的截图enter image description here

纯黑图像和一张训练图像检测的截图。

enter image description here

以防万一,这是cpp文件的链接。

http://dlib.net/train_object_detector.cpp.html

提前感谢您。


回答:

您不应该裁剪训练图像。您需要提供与测试时使用的图像相似的训练图像。

在这种情况下,图像窗口的特征向量的一部分是从图像外部区域提取的(因为您的对象被裁剪得非常紧),并且由于图像外部被假定为黑色,它学会了您的对象总是被黑色像素包围。

Related Posts

Keras Dense层输入未被展平

这是我的测试代码: from keras import…

无法将分类变量输入随机森林

我有10个分类变量和3个数值变量。我在分割后直接将它们…

如何在Keras中对每个输出应用Sigmoid函数?

这是我代码的一部分。 model = Sequenti…

如何选择类概率的最佳阈值?

我的神经网络输出是一个用于多标签分类的预测类概率表: …

在Keras中使用深度学习得到不同的结果

我按照一个教程使用Keras中的深度神经网络进行文本分…

‘MatMul’操作的输入’b’类型为float32,与参数’a’的类型float64不匹配

我写了一个简单的TensorFlow代码,但不断遇到T…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注