OpenCV阳性样本尺寸? [英] OpenCV positive samples dimensions?

查看:326
本文介绍了OpenCV阳性样本尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我遇到了许多关于OpenCV的haartraining和级联培训工具的教程。特别是我有兴趣训练一个汽车分类器使用createsamples工具,但似乎有关于-w和-h参数的地方的冲突声明,所以我很困惑。
我指的是命令:

So I've come across lots of tutorials about OpenCV's haartraining and cascaded training tools. In particular I'm interested in training a car classifier using the createsamples tool but there seem to be conflicting statements all over the place regarding the -w and -h parameters, so I'm confused. I'm referring to the command:

$ createsamples -info samples.dat -vec samples.vec -w 20 -h 20

我有以下三个问题:


  • 我知道正样本的长宽比应该与上面的-w和-h参数得到的长宽比相同。但是,所有正样本的-w和-h参数必须是相同的 size ,以及?例如。我有接近1000图像。

  • I understand that the aspect ratio of the positive samples should be the same as the aspect ratio you get from the -w and -h parameters above. But do the -w and -h parameters of ALL of the positive samples have to be the same size, as well? Eg. I have close to 1000 images. Do all of them have to be the same size after cropping?

如果不是尺寸,而是宽高比,那么匹配必须是与OpenCV工具中提到的-w和-h参数相比,正样本的纵横比是多少?我的意思是,是分类器非常敏感,所以即使几个像素,这里和那里会影响其性能?

If it is not the size but the aspect ratio that matters, then how precisely matching must the aspect ratio be of the positive samples, compared to the -w and -h parameters mentioned in the OpenCV tools? I mean, is the classifier very sensitive, so that even a few pixels off here and there would affect its performance? Or would you say that it's safe to work with images as long as they're all approximately the same ratio by eye.

我已经裁剪了几张图片相同大小。但是,在试图使它们的尺寸相同,其中一些有更多的背景包括在边界框比其他,并且一些有稍微不同的边距。 (例如,见下面的两张图片,较大的汽车占据了更多的图像,但是小汽车周围有一个更宽的边缘)。我只是想知道如果有这样的图像集合是好的,或者如果它会降低分类器的准确性,因此我应该确保围绕所有感兴趣的对象(在这种情况下,汽车)更紧密的边界框? p>

I have already cropped several images to the same size. But in trying to make them all the same size, some of them have a bit more background included in the bounding boxes than others, and some have slightly different margins. (For example, see the two images below. The bigger car takes up more of the image, but there's a wider margin around the smaller car). I'm just wondering if having a collection of images like this is fine, or if it will lower the accuracy of the classifier and that I should therefore ensure tighter bounding boxes around all objects of interest (in this case, cars)?

推荐答案

第一个问题:是的,用于训练的所有图像必须具有相同的大小。 (至少最后一次我做面部检测样本训练,应该是一样的如果我没有错,如果图像不是相同的大小会有一个错误,但是你可以试试看看时间许可证。)

First Question: Yes, all the images to be used for training have to be the same size. (at least for the last time I did face detection sample training. Should be the same here. If I am not wrong, there will be an error if the images are not of same size. But u can try it out and see if time permits.)

第二个问题:不太确定你在这里问什么。但分类器不是那么敏感,因为你认为。离感兴趣的对象几个像素,让我们说例如手,如果小手指丢失了几个像素(由于裁剪)和其他图像有少量像素丢失的拇指,等...分类器仍然会能够检测手。所以几个像素缺少这里和那里或几个背景像素添加,将不会影响分类器很多在一天结束。

Second Question: Not really sure what you are asking here. But the classifier is not that sensitive as u think. A few pixels off the object of interest, let's say the hand for instance, if the little finger is missing a few pixels(due to cropping) and other images have few pixels missing for the thumb, etc... the classifier will still be able to detect the hand. So a few pixels missing here and there or a few background pixels added in, will not affect the classifier much at the end of the day.

第三个问题:你应该裁剪图像包括汽车只为最大的结果。尝试消除尽可能多的背景。我做了一个基于具有嘈杂背景,黑色背景和最小背景的裁剪样品的样品的研究。具有最小背景的裁剪样品在假阳性和假阴性方面表现出最好的结果,从我记得的。

Third Question: You should crop the image to consist of the car only for maximum result. try eliminate as much background as possible. I did a research based on samples with noisy background, black background and cropped samples with minimum background. Cropped samples with minimum background shows the best results in terms of false positive and false negative, from what I remember.

U可以使用对象标记来执行此操作: http://achuwilson.wordpress.com/2011/02/13/object-detection-using-opencv-using-haartraining/

U can use object marker to do it: http://achuwilson.wordpress.com/2011/02/13/object-detection-using-opencv-using-haartraining/

繁琐的方式是使用paint在裁剪后将所有图片调整为相同的像素值。

The tedious way would be to use paint to resize all the image to the same pixel value after cropping.

也回答您的问题: http:// coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html

我也同意GilLevi与Haar,HoG,LBP级联相比,有更好的检测方法。训练图像可能需要几天(取决于训练的图像数量)。如果你真的需要使用级联方法,并且希望尽量减少培训时间,那么使用Haar-like功能的
训练比使用HoG或LBP要花费的时间更长。但结果明智,我不确定哪个将确保更好的性能和鲁棒性。

I also agree with GilLevi that there are much better detection methods compared to Haar, HoG, LBP cascade. training of the images can take days(depends on number of images trained). If you really have to use the cascade methods and you are looking to minimise training time, training with Haar-like features takes much longer than with HoG or LBP. But results wise, I am not really sure which will ensure better performance and robustness.

希望我的回答帮助了你。如果还有更多的问题,请做评论。

Hope my answer helped you. Should there be more questions, do comment.

这篇关于OpenCV阳性样本尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆