--- layout: post title: "Deep Learning Haar Cascade Explained" subtitle: "" description: "翻译" excerpt: "这是我认为最通俗易懂的 Haar 级联分类器的解释说明,文末视频非常形象。" date: 2020-03-04 14:42:00 author: "Rick Chan" tags: ["AI", "Classifier", "Haar"] categories: ["Algorithm"] published: true --- [原文连接] “Alright! This is where we start having some fun! The concept behind the Haar Cascade and how it is used in the real world is nothing short of amazing. So what is it?” Haar 级联分类器的背后思想以及其现实应用实在令人倍感惊奇。 ## Haar cascade “Haar Cascade is a machine learning object detection algorithm used to identify objects in an image or video and based on the concept of features proposed by Paul Viola and Michael Jones in their paper "Rapid Object Detection using a Boosted Cascade of Simple Features" in 2001.“ Haar 级联分类器是一种机器学习算法,最初由 Paul Viola 和 Michael Jones 在 2001 年的论文《Rapid Object Detection using a Boosted Cascade of Simple Features》中提出。该算法能够通过特征来识别图像或视频中的物体。 “It is a machine learning based approach where a cascade function is trained from a lot of positive and negative images. It is then used to detect objects in other images.” 通过 positive images(包含检测目标的样本) 和 negative images(不包含检测目标的样本)样本集进行训练的级联分类器,能够检测其他图像中的目标物体。 “The algorithm has four stages: 1. Haar[1] Feature Selection 2. Creating Integral Images[2] 3. Adaboost[3] Training 4. Cascading Classifiers“ ## 标注 [1] Haar “A Haar-like feature considers adjacent rectangular regions at a specific location in a detection window, sums up the pixel intensities in each region and calculates the difference between these sums.“ “This difference is then used to categorize subsections of an image. For example, let us say we have an image database with human faces. It is a common observation that among all faces the region of the eyes is darker than the region of the cheeks. Therefore a common Haar feature for face detection is a set of two adjacent rectangles that lie above the eye and the cheek region. The position of these rectangles is defined relative to a detection window that acts like a bounding box to the target object (the face in this case).“ [2] Integral Images “An integral image is summed-area table is a data structure and algorithm for quickly and efficiently generating the sum of values in a rectangular subset of a grid. To understand this look at image 1 and image 2. Image 1 is the source table, Image 2 is the summation table. Notice in Image 2 row 1, col 2 value 33 is sum of Image 1 row 1 (col 1 + col 2).“ ![Integral Images](./img/Deep_Learning_Haar_Cascade_Explained/001.png) [3] Adaboost “Problems in machine learning often suffer from the curse of dimensionality — each sample may consist of a huge number of potential features (for instance, there can be 162,336 Haar features, as used by the Viola–Jones object detection framework, in a 24×24 pixel image window), and evaluating every feature can reduce not only the speed of classifier training and execution, but in fact reduce predictive power, per the Hughes Effect.[3] Unlike neural networks and SVMs, the AdaBoost training process selects only those features known to improve the predictive power of the model, reducing dimensionality and potentially improving execution time as irrelevant features need not be computed.“ ## 参考资料 [人脸检测之Haar分类器](https://www.cnblogs.com/zyly/p/9410563.html) [What’s the Difference Between Haar-Feature Classifiers and Convolutional Neural Networks?](https://towardsdatascience.com/whats-the-difference-between-haar-feature-classifiers-and-convolutional-neural-networks-ce6828343aeb) [Computer Vision — Detecting objects using Haar Cascade Classifier](https://towardsdatascience.com/computer-vision-detecting-objects-using-haar-cascade-classifier-4585472829a9) [Deep Learning Haar Cascade Explained](http://www.willberger.org/cascade-haar-explained/) [浅析人脸检测之Haar分类器方法:Haar特征、积分图、AdaBoost、级联](https://blog.csdn.net/zouxy09/article/details/7922923)