Haar Cascade Classifier

A Haar classifier, or a Haar cascade classifier, is a machine learning object detection program that identifies objects in an image and video. Haar Cascade classifiers are an effective way for object detection and in cases to confirm if the subject is facing straight to the camera in face recognition based applications. 

Haar Cascade is a machine learning-based approach where a lot of positive and negative images are used to train the classifier. 

Positive images – These images contain the images which we want our classifier to identify.

Negative Images – Images of everything else, which do not contain the object we want to detect.

The algorithm can be explained in four stages:

1. Calculating Haar Features: The first step is to collect the Haar features. A Haar feature is essentially calculations that are performed on adjacent rectangular regions at a specific location in a detection window. The calculation involves summing the pixel intensities in each region and calculating the differences between the sums.

2. Creating Integral Images: Integral images essentially speed up the calculation of these Haar features. Instead of computing at every pixel, it instead creates sub-rectangles and creates array references for each of those sub-rectangles. These are then used to compute the Haar features.

3. Using Adaboost: Adaboost essentially chooses the best features and trains the classifiers to use them. It uses a combination of “weak classifiers” to create a “strong classifier” that the algorithm can use to detect objects. Weak learners are created by moving a window over the input image, and computing Haar features for each subsection of the image. This difference is compared to a learned threshold that separates non-objects from objects.

4. Implementing Cascading Classifiers: The cascade classifier is made up of a series of stages, where each stage is a collection of weak learners. Weak learners are trained using boosting, which allows for a highly accurate classifier from the mean prediction of all weak learners. Based on this prediction, the classifier either decides to indicate an object was found (positive) or move on to the next region (negative). Stages are designed to reject negative samples as fast as possible, because a majority of the windows do not contain anything of interest.

Leave a comment

Your email address will not be published. Required fields are marked *