向非技术人员解释 AdaBoost 算法
我一直在尝试理解 AdaBoost 算法,但没有取得太大成功。我正在努力理解 Viola Jones 的论文以人脸检测为例。
您能否用通俗易懂的方式解释 AdaBoost 并提供使用它的良好示例?
I've been trying to understand the AdaBoost algorithm without much success. I'm struggling with understanding the Viola Jones paper on Face Detection as an example.
Can you explain AdaBoost in laymen's terms and present good examples of when it's used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Adaboost 是一种将性能较差的分类器(又称弱学习器)组合成性能更高的更大分类器的算法。
它是如何运作的?以一种非常简单的方式:
幕后有一个广泛而详细的理论,但直觉就是:让每个“愚蠢”的分类器专注于以前的分类器无法修复的错误。
AdaBoost 是机器学习社区中最常用的算法之一。特别是,当您知道如何创建简单的分类器(可能有许多不同的分类器,使用不同的特征)并且您希望以最佳方式组合它们时,它非常有用。
在 Viola 和 Jones 中,每种不同类型的弱学习器都与您可以拥有的 4 或 5 种不同 Haar 特征之一相关联。
Adaboost is an algorithm that combines classifiers with poor performance, aka weak learners, into a bigger classifier with much higher performance.
How does it work? In a very simplified manner:
There is a broad and detailed theory behind the scenes, but the intuition is just that: let each "dumb" classifier focus on the mistakes the previous ones were not able to fix.
AdaBoost is one of the most used algorithms in the machine learning community. In particular, it is useful when you know how to create simple classifiers (possibly many different ones, using different features), and you want to combine them in an optimal way.
In Viola and Jones, each different type of weak-learner is associated to one of the 4 or 5 different Haar features you can have.
AdaBoost 使用大量训练样本图像(例如人脸)来挑选一些好的“特征”/“分类器”。对于人脸识别,分类器通常只是具有特定平均颜色值和相对大小的像素矩形。 AdaBoost 将查看多个分类器,并根据样本图像找出哪一个是面部的最佳预测器。选择最佳分类器后,它将继续寻找另一个分类器,直到达到某个阈值,并且这些分类器组合在一起将提供最终结果。
您可能不想与非技术人员分享这部分:)但无论如何它很有趣。有几个数学技巧可以使 AdaBoost 快速进行人脸识别,例如能够将图像的所有颜色值相加并将它们存储在二维数组中,以便任何位置的值都是所有像素的总和以及该位置的左侧。该数组可用于非常快速地计算图像内任何矩形的平均颜色值,方法是用右下角的值减去左上角的值,然后除以矩形中的像素数。使用此技巧,您可以快速扫描整个图像,寻找与特定颜色匹配或接近的不同相对大小的矩形。
希望这有帮助。
AdaBoost uses a number of training sample images (such as faces) to pick a number of good 'features'/'classifiers'. For face recognition a classifiers is typically just a rectangle of pixels that has a certain average color value and a relative size. AdaBoost will look at a number of classifiers and find out which one is the best predictor of a face based on the sample images. After it has chosen the best classifier it will continue to find another and another until some threshold is reached and those classifiers combined together will provide the end result.
This part you may not want to share with non-technical people :) but it is interesting anyway. There are several mathematical tricks which make AdaBoost fast for face recognition such as the ability to add up all the color values of an image and store them in a 2 dimensional array so that the value in any position will be the sum of all the pixels up and to the left of that position. This array can be used to very quickly calculate the average color value of any rectangle within the image by subtracting the value found in the top left corner from the value found in the bottom right corner and dividing by the number of pixels in the rectangle. Using this trick you can quickly scan over an entire image looking for rectangles of different relative sizes that match or are close to a particular color.
Hope this helps.
这是可以理解的。您可以在互联网上找到的大多数论文都讲述了 Viola-Jones 和 Freund-Shapire 的论文,它们是 AdaBoost 在 OpenCV 中应用于人脸识别的基础。它们大多由来自多个数学领域的困难公式和算法组合而成。
以下是可以帮助您的内容(足够短) -
1 - 它用于对象,并且主要用于面部检测识别。最流行且非常好的 C++ 库最初是来自 Intel 的 OpenCV。我以OpenCV中人脸检测的部分为例。
2 - 首先,使用样本矩形(“特征”)的级联增强分类器在带面部(称为正)和不带面部的图像样本上进行训练(负数)。
来自谷歌搜索的一些论文:
“·Boosting 是指一种通用且可证明有效的方法,通过结合粗略和适度不准确的经验法则来生成非常准确的分类器。
·它基于这样的观察:找到许多粗略的经验法则可能会花费很多时间。比找到一个高度准确的分类器更容易。
首先,我们定义一个寻找经验规则的算法,我们称之为弱学习器。
增强算法重复调用这个弱学习器,每次都给它提供不同的分布。训练数据(在 AdaBoost 中)。
· 每个调用都会生成一个弱分类器,我们必须将所有这些组合成一个分类器,希望它比任何一个规则都准确得多。”
在此过程中,扫描图像以确定与每张脸的特定部分相对应的独特区域。应用基于复杂计算假设的算法(一旦你掌握了主要思想,就不难理解)。
这可能需要一周的时间,输出是一个 XML 文件,其中包含有关如何快速检测人脸的学习信息,例如,任何图片的正面位置(在其他情况下可以是任何对象)。
3 - 之后,您将此文件提供给 OpenCV 人脸检测程序,该程序运行速度非常快,阳性率高达 99%(取决于条件)。
正如这里提到的,通过称为“积分图像”的技术可以大大提高扫描速度。
最后,这些都是有用的资源 - OpenCV 中的对象检测 和
使用 AdaBoost 进行通用对象检测,加利福尼亚大学,2008 年。
This is understandable. Most of the papers you can find on Internet retell Viola-Jones and Freund-Shapire papers which are foundation of AdaBoost applied for face recognition in OpenCV. And they mostly consist of difficult formulas and algorithms from several mathematical areas combined.
Here is what can help you (short enough) -
1 - It is used in object and, mostly, in face detection-recognition.The most popular and quite good C++ library is OpenCV from Intel originally. I take the part of Face detection in OpenCV, as an example.
2 - First, a cascade of boosted classifiers working with sample rectangles ("features") is trained on sample of images with faces (called positive) and without faces (negative).
From some Googled paper:
"· Boosting refers to a general and provably effective method of producing a very accurate classifier by combining rough and moderately inaccurate rules of thumb.
· It is based on the observation that finding many rough rules of thumb can be a lot easier than finding a single, highly accurate classifier.
· To begin, we define an algorithm for finding the rules of thumb, which we call a weak learner.
· The boosting algorithm repeatedly calls this weak learner, each time feeding it a different distribution over the training data (in AdaBoost).
· Each call generates a weak classifier and we must combine all of these into a single classifier that, hopefully, is much more accurate than any one of the rules."
During this process the images are scanned to determine the distinctive areas corresponding to certain part of every face. The complex calculation-hypothesis based algorithms are applied (which are not so difficult to understand once you get the main idea).
This can take a week and the output is an XML file which contains the learned information on how to quickly detect the human face, say, in frontal position on any picture (it can be any object in other case).
3 - After that you supply this file to OpenCV face detection program which runs quite fast with up to 99% positive rate (depending on conditions).
As was mentioned here, the scanning speed can be increased greatly with technique known as "integral image".
And finally, these are helpful sources - Object Detection in OpenCV and
Generic Object Detection using AdaBoost from University of California, 2008.