# Viola Jones Algorithm

Can Viola Jones algorithm be used to detect the facial emotion. Actually it was used in creating harr-cascade file for object and facial detection, but what confused me is whether it can be used to train for emotion detection.

If not, what algorithms can I use? and what are the mathematical bases? (i.e. what mathematics should I be studying?)

• Welcome to AI! Very interesting question that I'd also be interested in knowing the answer to. (My guess would be that there is some overlap, but I know next to nothing about this subject!)
– DukeZhou
Jan 9, 2018 at 22:22

An introduction to the Haar features is provided in the youTube video. The video indicates the VJ face detector leverages a selected combination of Haar features (convolutional kernels) to detect facial features (weak classifiers), such as the nose bridge. The binary presence of the weak classifiers are summed to determine if the window contains a face.

The ability for a VJ algorithm to detect emotion would rely on the ability to assign a set of Haar features (kernels) to recognize features associated with a particular emotion label (surprise, anger, content, fear).

It is conceivable that the initial stage of an emotion classifier could use a the VJ algorithm to identify a face for additional stages to classify emotion.

I have once tried Viola Jones Algorithm to do that, it does not capture the subtle differences in the direction of facial segments which are important to detect emotion. Features like HOG (Available in openCV and many famous image processing libraries) can extract better information from the face to classify emotion.

Also there are many other approaches including ANNs and pure rule based approaches But almost everywhere a good alignment approach for faces become the most important aspect of the exercise. So I will suggest exploring some facial alignment approaches and then Features like HOG instead of Viola Jones/ HARR.

For the mathematics part, it is upto you to dive deep into mathematics or just exploring different approaches by codes. A good understanding of Linear Algebra and a little Geometry will help a lot.

Also if you are new to Machine Learning, understanding the basic algorithms might be relevant to you.

• I'm trying to feed the values that i got from the HOG descriptor to the keras Deep learning model, but the problem arises when feeding the feature to that model, as feature can take any random size from images to images. Can i perform SVM on top. Please refer to any articles, blog post. Aug 8, 2018 at 18:36
• No you can not model with any algorithm with changing feature size. Each face will differ in many aspects. I would suggest that you first get some Canonical and normalised face before you extract any features from it. A pre decided size of the crop and location of the eye works in many cases. Aug 13, 2018 at 13:06