haar-like feature ins and outs
Disclaimer: Reference Please specify the source http://blog.csdn.net/lg1259156776/ haar-like feature Concept
Haar-like feature is a commonly used feature description operator in computer vision field. It was first used by Papageorigiou and other people to describe the face. At present, Haar-like features can be divided into three categories: Linear feature, Edge feature, point feature (center feature), diagonal feature. As shown in the figure below
The Haar feature (Haar-like features) is a digital Image feature for object recognition. Because they are very similar to the Haar wavelet transform, they are named as the first real-time face detection operator. characteristics of Haar-like features
The Haar characteristic value reflects the gray-level change of the image . For example: Some features of the face can be described by a simple rectangular feature, such as: The eye is darker than the cheek color, the nose bridge on both sides of the bridge than the color to deep, mouth than the surrounding color to be deep. But the rectangle feature is sensitive to some simple graphic structures, such as edges and segments, so it can only describe the structure of a particular trend (horizontal, vertical, diagonal).
By changing the size and position of the feature template, a large number of features can be quoted in the Image sub-window. The feature template of the image above is called "feature prototype"; The feature prototype expands (pans out) in the image Subwindow, which is called the "rectangular feature", and the value of the rectangle feature is called the eigenvalue.
Rectangular features can be anywhere in the image, and the size can be arbitrarily changed, so the rectangular eigenvalue is a rectangular template category, rectangular position and the size of the rectangle three factors of the function. Therefore, the category, size and position changes, so that very small detection window contains a lot of rectangular features, such as: In the 24*24 pixel size of the detection window within the number of rectangular features can reach 160,000. So there are two problems to solve: (1) How to quickly calculate so many characteristics . -Integral graph, (2) which rectangular features are most effective for classifying classifiers. such as through the AdaBoost algorithm to train. fast calculation of haar-like characteristics by integral graphs
This aspect of the content is relatively simple and familiar, do not do too much summary. As you can see from the following figure and the formula:
The four vertices of D are α, β, γ, Shang, β, γ, δ, and the pixels of D and can be expressed as
∑d=ii (α) +ii (β) − (ii (γ) +ii (δ)) \sum D = II (α) +ii (β)-(II (γ) +ii (δ))
The Haar-like eigenvalue is nothing more than two matrix pixels and the difference, can also be completed in constant time.
adaboost algorithm training face classifier
The initial weak classifier may be just one of the most basic haar-like features, calculating the haar-like eigenvalue of the input image, and comparing the eigenvalues of the original weak classifier to determine whether the input image is a human face. Such a weak classification is actually a decision stump, decision tree stump, that is, greater than the input characteristics greater than the threshold is considered a human face, less than is considered not.
The adaboost algorithm simply requires that each decision stump have a slightly better probability than a random guess, which means that it is slightly larger than 50%. Just ensure that each decision stump can take care of different aspects separately, that is to say decision stump is differentiated. Here's a classic example:
The teacher asked the students what is Apple, each classmate said a classmate did not say the characteristics of the apple, such as classmate A said that the Apple is round (shape characteristics), classmate B said that Apple is sweet (taste characteristics), classmate C said Apple is mostly red (color characteristics), etc. Together, these descriptions will help you understand Apple without knowing Apple's new classmates.
The specific algorithm of AdaBoost can refer to my blog "Machine Learning techniques Summary (v) Adaptive boosting, adaboost-stump, decision tree" and "machine learning techniques Realization (a): Adaboost-decision Stump (AdaBoost-a MATLAB-based implementation of the decision tree).
The last to get is actually a decision tree, each tree node is a decision stump, very simple weak classifier. You can also refer to the two blog posts above for decision trees, as explained in Wikipedia:
"In machine learning, a decision tree is a predictive model; he represents a mapping between object properties and object values. Each node in the tree represents an object, and each fork path represents a possible property value, and each leaf node represents the value of the object represented by the path from the root node to the leaf node. The decision tree has only a single output, and if you want to have complex output, you can create an independent decision tree to handle different outputs. The machine learning technology from data generation decision tree is called Decision Tree Learning, and popular is decision tree. (from "Wikipedia")
The following figure is the trained decision tree for face detection recognition:
Only through all the decision-making stump detection will be identified as a human face, as if only to meet all the students to describe the characteristics of Apple, new students will think it is Apple.
2015-9-23 Less Art