I'm using an OpenCV Haar classifier in my work but I keep reading conflicting reports on whether the OpenCV Haar classifier is an SVM or not, can anyone clarify if it is using an SVM? Also if it is not using an SVM what advantages does the Haar method offer over an SVM approach?
2 Answers
SVM and Boosting (AdaBoost, GentleBoost, etc) are feature classification strategies/algorithms. Support Vector Machines solve a complex optimization problem, often using kernel functions which allows us to separate samples by working in a much higher dimension feature space. On the other hand, boosting is a strategy based on combining lots of "cheap" classifiers in a smart way, which leads to a very fast classification. Those weak classifiers can be even SVM.
Haar-like features are a kind of features based in integral images and very suitable for Computer Vision problems.
This is, you can combine Haar features with any of the two classification schemes.

- 3,838
- 4
- 28
- 50
-
So am I correct in saying that the advantage to using AdaBoost over SVM is that it will allow a classifier to be trained faster than an SVM? Second question, assuming my first was correct, does this lead to detecting objects in a video stream any faster or does the speed difference only apply to the training stage? – Colin747 Apr 28 '14 at 15:05
-
Both are off-the-shelf methods you can try (e.g. with OpenCV). I'd say SVMs are easier to train and evaluate (and understand). However, as they are both non-parametric, overfitting-avoiding methods, I think I'd try them both and see which one gave best validation results. – Яois Apr 28 '14 at 15:10
-
At the moment I'm implementing OpenCV Haar classifier with AdaBoost and it's working well but I would like to be able to explain what is going on behind the code hence my interest. – Colin747 Apr 28 '14 at 15:12
-
1Ok: what openCV does is 1) Extracting Haar features from images 2) Training weak classifiers consisting on thresholding certain features (read the original paper by Viola&Jones for more info) 3) Arranging those weak classifiers using a voting scheme (this is the Adaboost algorithm). – Яois Apr 28 '14 at 15:18
-
In the classification stage, the first classifiers are those who discard easily the negative samples (non-object images), hence the boosting. – Яois Apr 28 '14 at 15:19
-
Thanks for the help, I understand the AdaBoost method now from your explanation. Just to clarify if I used an SVM it would 1) Extract Haar features from images 2) It would then use the SVM to classify the features. Is this correct? – Colin747 Apr 28 '14 at 15:25
-
let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/51608/discussion-between-keillrandor-and-colin747) – Яois Apr 28 '14 at 15:25
It isn't SVM. Here is the documentation: http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html#haar-feature-based-cascade-classifier-for-object-detection
It uses boosting (supporting AdaBoost and a variety of other similar methods -- all based on boosting).
The important difference is related to speed of evaluation is important in cascade classifiers and their stage based boosting algorithms allow very fast evaluation and high accuracy (in particular support training with many negatives), at a better balance point than an SVM for this particular application.

- 12,022
- 4
- 45
- 62
-
So would it be correct in saying an SVM would still be more accurate but at the cost of evaluation speed? (By evaluation speed I assume to mean time taken to recognise an object in a live video stream?) – Colin747 Apr 28 '14 at 14:53
-
@Colin747: A non-linear SVM is probably more accurate, but you'd have to try. And yes, it could easily be 1000 times slower, which is a deal breaker in this area. – carlosdc Apr 28 '14 at 15:22