简体   繁体   English

HaarCascade培训:合并.lst文件

[英]HaarCascade training: merge .lst files

I am working on an own object detector using HaarCascade. 我正在使用HaarCascade开发自己的物体探测器。 BTW, I am stucked at some point, which I'll explain below. 顺便说一下,我在某些方面感到困惑,我将在下面解释。

The situation it's this: - I collected 100 images of my object (let's say apples) - I collected about 1500 negatives images - I created negatives.txt , a file which contains paths to the negatives images - I created positives.txt , a file which contains paths, number of objects, coordinates and dimensions of my positive images 情况就是这样: - 我收集了100 个我的对象图像 (比如苹果) - 我收集了大约1500张底片 - 我创建了negatives.txt ,一个包含负片图像路径的文件 - 我创建了positives.txt ,一个文件其中包含路径,对象数量,正面图像的坐标和尺寸

Now, this is the problem. 现在,这就是问题所在。

Using opencv_createsamples.exe to augment my data/images, I saw that if I execute it (with same parameters) for each object image, the output will be more or less a 1000 positive images (negatives background + object) together with a .lst file containing path and object coordinates inside the negative image. 使用opencv_createsamples.exe来扩充我的数据/图像,我看到如果我为每个对象图像执行它(使用相同的参数),输出将或多或少是1000个正图像(负面背景+对象)和.lst file包含负片图像内的路径和对象坐标的.lst file These coordinates will not change (because I set them when I executed opencv_createsamples.exe ). 这些坐标不会改变(因为我在执行opencv_createsamples.exe时设置它们)。

The question is: it's a good idea to change the parameters createsamples requires for each of my object image and then merge them all ? 问题是:为每个对象图像更改createsamples所需的参数然后将它们全部合并是个好主意?

Example of what I am doing now: 我现在在做什么的例子:

  • opencv_createsample.exe -p1 0.5 -p2 0.6 -p3 0.7 opencv_createsample.exe -p1 0.5 -p2 0.6 -p3 0.7
  • for one of my object image for each of my negatives 对于我的每个底片我的一个对象图像
  • .lst file with info's (the same if execute for each positive ojbect image) 带信息的.lst文件(如果为每个正面ojbect图像执行,则相同)

Example of what I am willing to do: 我愿意做的例子:

  • for each of my object image for each of my negatives 对于我的每个底片的每个对象图像
  • opencv_createsample.exe -p1 0.5 -p2 0.6 -p3 0.7 - opencv_createsample.exe -p1 0.6 -p2 0.7 -p3 0.8, and so on (with random values of parameters) opencv_createsample.exe -p1 0.5 -p2 0.6 -p3 0.7 - opencv_createsample.exe -p1 0.6 -p2 0.7 -p3 0.8,依此类推(带参数的随机值)
  • multiple .lst files with different info's for each object image 多个.lst文件,每个对象图像具有不同的信息
  • merge of all .lst 合并所有.lst

I really hope I explained all. 我真的希望我解释了所有。

My doubt it's about efficiency of doing this: I will have a better accuracy by training using different objects (of the same class) in different position or it's the same by using only one object ? 我怀疑这是关于这样做的效率:通过在不同位置训练使用不同对象(同一类)或通过仅使用一个对象来获得更好的准确性?

Glossary: 名词解释:

  • object = what I want to detect (an apple) object =我要检测的东西(一个苹果)
  • negative image = background image not containing the object 负图像=不包含对象的背景图像
  • positive image = processed image (createsamples output) with negative + object 正图像=带负+对象的已处理图像(创建样本输出)

Thanks all 谢谢大家

UPDATE UPDATE

Here after watching Sentdex video on HaarCascade: Training Haar cascade object detection - OpenCV with Python for Image and Video Analysis 20 在观看HaarCascade上的Sentdex视频之后: 训练Haar级联对象检测 - 用于图像和视频分析的OpenCV用于图像和视频分析20

I think you'd have better results training your model with multiple objects in each (positive) image. 我认为你可以在每个(正面)图像中使用多个对象训练你的模型有更好的结果。 It also depends on what you want to achieve. 这还取决于你想要达到的目标。 1. Try both approaches you mentioned in your question and test them using the same images. 1.尝试您在问题中提到的两种方法,并使用相同的图像进行测试。 2. Compare the effectiveness (accuracy of detection) and also efficiency (is there noticeable difference in speed, for instance?) 2.比较有效性(检测的准确性)和效率(例如,速度有明显差异吗?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM