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

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

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