Haar Cascades vs. LBP Cascades in Face Detection [closed]
Asked Answered
F

5

59

I have been experimenting with face detection in OpenCV (Open Source Computer Vision Library), and found that one could use Haar cascades to detect faces as there are several of them provided with OpenCV. However, I have noticed that there are also several LBP cascades. After doing some research, I found that LBP stands for Local Binary Patterns, and it can also be used for face detection, according to the OpenCV Face Detection Documentation.

What I would like to know is, which works better? Which one performs faster, and which one is more accurate? It seems that LBP performs faster, but I'm not 100% sure about that either. Thanks.

Fp answered 9/1, 2012 at 15:53 Comment(0)
F
71

LBP is faster (a few times faster) but less accurate. (10-20% less than Haar).

If you want to detect faces on an embedded system, LBP is the default choice, because it does its calculations in integers.

Haar uses floats for processing, which have poorer support on embedded and mobile processors; as a result, the performance penalty is significant - big enough to make its usage on mobile phones impractical.

Furcula answered 9/1, 2012 at 16:43 Comment(1)
which paper does opencv refer to with LBP algorithm on face detection? "Face Detection Based on Multi-Block LBP Representation"?Honorine
D
28

An LBP cascade can be trained to perform similarly (or better) than the Haar cascade, but out of the box, the Haar cascade is about 3x slower, and depending on your data, about 1-2% better at accurately detecting the location of a face. This increase in accuracy is quite significant given that face detection can operate in the 95%+ accuracy range.

Below are some results when using the MUCT dataset.

A correct detection is noted when there is at least a 50% overlap between the ground-truth and OpenCV detected coordinates.

Cascade:haarcascade_frontalface_alt2.xml
Datafile:muct.csv
|---------------------------------------------------|
|   Hits  |  Misses  | False Detects  | Multi-hit   |
|  3635   |   55     |   63           |    5        |
|---------------------------------------------------|
Time:4m2.060s

vs:

Cascade:lbpcascade_frontalface.xml
Datafile:muct.csv
|---------------------------------------------------|
|   Hits  |  Misses  | False Detects  | Multi-hit   |
| 3569    |  106     |   77           |    3        |
|---------------------------------------------------|
Time:1m12.511s
Domitiladomonic answered 23/5, 2014 at 19:28 Comment(2)
Clearly LBP is less accurateChaiken
Clearly, LBP is much faster.Duroc
H
14

My personal opinion is that you should look into LBP for all detection related tasks simply because LBP training can take minutes while HAAR training can take days for the same training data set and parameters.

The question you have asked will have a different performance depending on the type of thing being detected, the training settings and the parameters used during detection as well as the criteria for testing the cascades.

The accuracy of both HAAR and LBP cascades depend on the data sets (positive and negative samples) used for training them and the parameters used during training.

according to Lienhart et al, 2002, in the case of face detection:

  • your -numStages, -maxDepth and -maxWeakCount parameters should be sufficiently high to achieve the desired -minHitRate and -maxFalseAlarmRate.
  • tree based training is more accurate than stump based,
  • gentle adaboost is preferable to discrete and real adaboost,
  • the min size of training sample matters but a systematic study about it has yet to be done.

also, flags used in detectMultiScale() yield a drastic change in speed as well as accuracy on a given hardware configuration.

for testing the cascade you should settle on a data set and a method such as k-fold cross validation.

Humbertohumble answered 23/11, 2013 at 11:5 Comment(0)
A
11

May be it will useful for you:

There is a Simd Library, which has an implementation of HAAR and LBP cascade classifiers. It can use standard HAAR and LBP casscades from OpenCV. This implementation has SIMD optimizations with using of SSE4.1, AVX2, AVX-512 and NEON(ARM), so it works in 2-3 times faster then original OpenCV implementation.

Aerometer answered 5/5, 2016 at 12:1 Comment(0)
R
7

Also, in training stages, LBP is faster than Haar. With 2000 pos sample and 300 neg sample, training using Haar type, it took about 5-6 days to complete, but with LBP, it took only some hours.

Remotion answered 2/6, 2013 at 0:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.