9 – Haar Cascades

Let’s build on top of our knowledge about feature extraction and object recognition, and think about how we might be able to simplify and speed up this whole pipeline. In this example, we’ll be building a face detector working with an algorithm called Haar cascades. This algorithm works by training on many positive images (images of faces) and negative images (images without faces). First, from each image, it detects so-called Haar features. Haar features are gradient measurements that look at rectangular regions around a certain pixel area and somewhat subtract these areas to calculate a pixel difference. This is similar to how convolution kernels work, only at a larger scale. Haar features detect patterns like edges, lines, and more complex rectangular patterns. In the case of face detection, lines and rectangles are especially useful features because patterns of alternating bright and dark areas define a lot of features on a face. For example, our pupils are typically a very dark feature, and cheeks and chins define a high gradient outline for a face. So far, Haar features are looking pretty similar to the beginning steps of a convolutional neural network, or even HOG feature extraction, but the next step is different, it’s a series of cascades. For any image of a face, a large portion of this image will be a non-face region. So what a Haar cascade does is, it looks at an image and applies a Haar feature detector like this vertical line detector, and then performs classification on the entire image. If it doesn’t get enough of a feature detection response, it classifies an area of an image as “not face” and discards this information. Then, it feeds this reduced image area to the next feature detector and classifies the image again, discarding irrelevant non-face areas at every step. This is called a “cascade of classifiers.” In this way, Haar cascades focus on processing and recognizing only the area in an image that’s been classified as part of a face already and quickly throwing out irrelevant image data makes this algorithm very fast, fast enough for processing a video stream in real time on a laptop computer. Haar cascades may also be used in selecting an area of interest for further processing so let’s get more practice with Haar cascades.

%d 블로거가 이것을 좋아합니다: