diff --git a/Algorithm/AI/Deep_Learning_Haar_Cascade_Explained.md b/Algorithm/AI/Deep_Learning_Haar_Cascade_Explained.md index 13c3a31..66dd7fd 100755 --- a/Algorithm/AI/Deep_Learning_Haar_Cascade_Explained.md +++ b/Algorithm/AI/Deep_Learning_Haar_Cascade_Explained.md @@ -43,6 +43,34 @@ Haar 级联分类器主要有四个步骤: “It is well known for being able to detect faces and body parts in an image, but can be trained to identify almost any object.” +Haar 级联分类器最著名的应用是检测图像中的人脸或身体,但其实也可以检测其他物体。 + +“Lets take face detection as an example. Initially, the algorithm needs a lot of positive images of faces and negative images without faces to train the classifier. Then we need to extract features from it.” + +本文以人脸检测为例。首先需要大量包含人脸的 positive image 和不包含人脸的 negative image 来训练分类器。然后我们从其中提取特征。 + +“First step is to collect the Haar Features. A Haar​ 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. ” + +第一步是收集 Haar 特征。可以将 Haar​ 特征看作检测窗口中相邻的举行区域,将各自区域的像素强度加合,然后计算它们的差值。 + +![Integral Images](/img/Deep_Learning_Haar_Cascade_Explained/001.jpg) + +“Integral Images are used to make this super fast.” + +可以使用积分图加快这一运算过程。 + +“But among all these features we calculated, most of them are irrelevant. For example, consider the image below. Top row shows two good features. The first feature selected seems to focus on the property that the region of the eyes is often darker than the region of the nose and cheeks. The second feature selected relies on the property that the eyes are darker than the bridge of the nose. But the same windows applying on cheeks or any other place is irrelevant. ” + +但是,这些特征中的很大一部分是与任务目标不相关的(没有意义的特征)。以下图为例,第一行显示了两个(与任务目标)相关的特征。第一个特征聚焦于眼部区域比鼻子和脸颊更黑这一特点;而第二个特征依赖于眼部比鼻梁更黑这一事实。但是,将同样的检测窗口应用于脸颊或其他部位则得不到有意义的特征。 + +![Integral Images](/img/Deep_Learning_Haar_Cascade_Explained/002.png) + +“So how do we select the best features out of 160000+ features? This is accomplished using a concept called Adaboost which both selects the best features and trains the classifiers that use them. This algorithm constructs a “strong” classifier as a linear combination of weighted simple “weak” classifiers. The process is as follows.” + +在人脸检测这一任务中,类似的特征足足有 160000 多个,如何从中选取最有意义的特征?这由 Adaboost 算法完成,该算法会选取最佳特征并训练分类器来使用这些特征。Adaboost 算法引入了强分类器和弱分类器的概念,强分类器由弱分类器线性组合而成。其算法过程如下: + +“During the detection phase, a window of the target size is moved over the input image, and for each subsection of the image and Haar features are calculated. You can see this in action in the video below. This difference is then compared to a learned threshold that separates non-objects from objects. Because each Haar feature is only a "weak classifier" (its detection quality is slightly better than random guessing) a large number of Haar features are necessary to describe an object with sufficient accuracy and are therefore organized into cascade classifiers to form a strong classifier.” + ## 标注 [1] Haar @@ -55,7 +83,7 @@ Haar 级联分类器主要有四个步骤: “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) +![Integral Images](./img/Deep_Learning_Haar_Cascade_Explained/004.png) [3] Adaboost diff --git a/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/001.jpg b/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/001.jpg new file mode 100755 index 0000000..18f7d78 Binary files /dev/null and b/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/001.jpg differ diff --git a/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/002.png b/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/002.png new file mode 100644 index 0000000..08fd268 Binary files /dev/null and b/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/002.png differ diff --git a/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/001.png b/Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/004.png similarity index 100% rename from Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/001.png rename to Algorithm/AI/img/Deep_Learning_Haar_Cascade_Explained/004.png