Jump to content

Cascading classifiers

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 80.215.20.96 (talk) at 23:24, 11 March 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Cascading is a particular case of ensemble learning based on the concatenation of several classifiers, using all information collected from the output from a given classifier as additional information for the next classifier in the cascade. Unlike voting or stacking ensembles, which are multiexpert systems, cascading is a multistage one.

The first cascading classifier is the face detector of Viola and Jones (2001). The requirement was that the classifier be fast in order to be implemented on low CPU systems, such as cameras and phones.

Basic algorithm

The algorithm can be summed up as follows: for all rectangles in the image:

  • stage 1: is there a face in the current rectangle according to classifier 1 ? if yes stage2, if no rectangle does not contain a face
  • stage 2: is there a face in the current rectangle according to classifier 2 ? if yes stage3, if no rectangle does not contain a face

...

  • stage n: is there a face in the current rectangle according to classifier n ? if yes there is a face in current rectangle

The question 'is there a face in the current rectangle according to classifier k?', for the stage number k ranging from 1 to n is answered by a collection of weak learners (that is, simple rules that cannot alone do the classification, but are expressive enough to be able to classify anything when combined). For example, the 'face in current rectangle' score of stage 1 might be 0.3*(centerpixels-leftpixels-rightpixels)+0.5*(-pixel 1/3 from the top + rest of pixels) > 0.8. The first condition expresses the fact that the nose catches the light (the center will be light and the sides dark, giving a high numerical result) and the second one the fact that eyebrows are darker than the rest of the face.

algorithm properties

scaling and rotations

It can be seen from this description that the classifier will not accept faces that are upside down (the eyebrows are not in a correct position) or the side of the face (the nose is no longer in the center, and there might no be shadows on the side of the nose). Separate cascade classifiers have to be trained for every rotation that is not in the image plane (side of face) and will have to be retrained or run on rotated features for every rotation that is in the image plane (face upside down or tilted to the side). Scaling is not a problem, since the features can be scaled (centerpixel, leftpixels and rightpixels have a dimension only relative to the rectangle examined). In recent cascades, pixel value from some part of a rectangle compared to another have been replaced with Haar wavelets, which extends the idea, since they multiply pixels by a sinusoid in a given window, so (centerpixels-leftpixels-rightpixels) will be replaced by a +cosinus between -pi and pi in a given window, giving a negative weight to the left and right and a positive weight in the center.

stage properties

To have good overall performance, the following criteria must be met:

  • each stage must validate all faces, and can produce many false positives. For example, if stage 1 were to mark as 'does not contain a face' 20% of rectangles containing a face (false negative rate=20%), then the total performance of the chain cannot be higher than 80% true positive, whatever the next stages are, since 20% of faces have already been rejected.
  • this suggests that a good stage must have 100% true positive and for example 40% false positive, that is accept all rectangles containing faces and erroneously mark many rectangles as potentially containing a face, to be eliminated by later stages. It should be noted that for a first stage, 100% true positive and 40% false positive still gives a lot of false negative, if only 1 in a 1000 rectangles in an image contain a face, there will still be 400 to 1 false possible faces after the first stage.
  • if the first stage is very fast (a few operations), we have eliminated 60% of rectangles not containing a face very quickly.

The training procedure for one stage is therefore to have many weak learners (simple pixel difference operators), train them as a group (raise their weight if they give correct result), but be mindful of having only a few active weak learners so the computation time remains low.

The first detector of Viola & Jones had 38 stages, with 1 feature in the first stage, then 10, 25, 25, 50 in the next five stages, for a total of 6000 features. The first stages remove unwanted rectangles rapidly to avoid paying the computational costs of the next stages, so that computational time is spent analyzing deeply the part of the image that have a high probability of containing the object.

cascade training

Cascades are usually done through cost-aware ADAboost. The sensitivity threshold (0.8 in our example) can be adjusted so that there is close to 100% true positives and some false positives. The procedure can then be started again for stage 2, until the desired accuracy/computation time is desired.

After the initial algorithm, it was understood that training the cascade a whole can be optimized, to achieve a desired true detection rate with minimal complexity. Examples of such algorithms are RCBoost, ECBoost or RCECBoost, in their most basic versions, they can be understood as choosing, at each step, between adding a stage or adding a weak learner to a previous stage, whichever is less costly, until the desired accuracy has been reached. Every stage of the classifier cannot have a detection rate (sensitivity) below the desired rate, so this is a constrained optimization problem. To be precise, the total sensitivity will be the product of stage sensitivities.

Cascade classifiers are available in OpenCV, with already trained cascades for frontal faces. Training a cascade on different object is possible (search for training a haar cascade, for example), but can currently take a few days.


See also

References

  • J. Gama and P. Brazdil. Cascade Generalization. Machine Learning, 41(3):315--343, 2000. [1]
  • J. Minguillón. On Cascading Small Decision Trees. PhD dissertation. Universitat Autònoma de Barcelona, 2002. [2]
  • H. Zhao and S. Ram. Constrained Cascade Generalization of Decision Trees. IEEE Transactions on Knowledge and Data Engineering, 16(6):727--739, 2004.