From Emotion Recognition to Website Customizations

A computer vision system that recognizes the emotions of a website’s user and customizes the context and the presentation of this website accordingly is presented herein. A logistic regression classifiers is trained over the Extended CohnKanade dataset in order to recognize the emotions. The ScaleInvariant Feature Transform algorithm over two different part of an image, the face and the eyes without any special pixel intensities preprocessing, is used to describe each emotion. The testing phase shows a significant improvement in the classification results. A toy web site, as a proof of concept, is also developed. Keywords—Emotion recognition; classification; computer vision; web interfaces


I. INTRODUCTION
The development of emotion aware systems is the next step in creating effective, trustworthy and persuasive web applications and websites.Websites capable of sensing and reacting to user's emotional state by adjusting their context and their look & feel (L&F) can be used from e-companies as powerful recommendation and advertisement tools or by website designers as a medium to increase user satisfaction.
Automatic detection of human emotions from digital images and videos is an active research area attracting a lot of attention in recent years.Interdisciplinary in nature it combines image processing, computer vision and machine learning and can be applied in large number of application especially in the area of human-computer-interaction (HCI).
Recognizing emotions with a high accuracy is a difficult task though.The emotions being communicated by human facial expressions are complex and vary constantly.Variations related to camera/face pose, occlusions of main facial components (e.g., eyes and nose), features as glasses and beards along with illumination conditions and camera technical characteristics make the problem even harder.
In this paper a system that automatically recognizes user emotions and customizes the context and the L&F of a website is presented.The representation of emotions by Scale-Invariant Feature Transform (SIFT) [4] descriptor is investigated.The descriptor applied on a dense grid of keypoints on two images; the face and the eyes of the user as they captured by a web camera.A logistic regression model is used to label the emotion and the context of the website along with its presentation are customized accordingly.This works is organized as follows.Section II briefly presents the related work.The overview of the system and the description of its parts are given in section III.Settings, experiments and their acquired results are presented in section IV.Finally conclusions are drawn and further work is given in section V.

II. RELATED WORK
Automatic emotion recognition consists of two key factors: the emotion representation and the development of a classifier.A set of features which effectively represents the emotion must be derived and from these features a model must be learned.
Pantic et al [7] proposed a ruled-based classifier in order to recognize facial actions based on contours changes.A multistage model is used to extract and encode features.Initially face, face profile and facial components detectors are used to locate contours.Then a number of fiducial points are extracted and selected defining a mid-level feature parameters used for the final encoding of the actions.They reported 86% accuracy.
Recognition accuracy 81.4% on Cohn-Kanade (CK) [5] dataset reported by Buciu et al. [1].They used Principal Component Analysis (PCA) as baseline and proposed a nonnegative matrix factorization and a local non-negative matrix factorization technique for recognizing six facial expressions.Shan et al. [8] worked with Local Binary Patterns (LBP).To extract the features and recognize the emotions they proposed a Support Vector Machine (SVM -RBF kernel) classifier with Boosted-LBP features.They used a fixed distance between the two eyes to normalized the faces and they manually labeled the eyes location, to evaluate LBP features in conditions without face registration errors.They reported a 91.4% accuracy.
Combining PCA with an SVM based classifier Vretos et al. [10] achieved 90% accuracy on the Cohn-Kanade dataset.They worked using analysis of vertices on Candide model (a parameterized face mask developed for model-based coding of human faces).Kalita et al. [3] used an eigenvector based method.Their images are cropped to produce five different eigen-spaces and Euclidean distance is used for classification.They achieved 95% recognition rate.Donia et al. [2] used histogram of oriented gradients (HOG) to extract features and trained an SVM classifier.The face is cropped for five regions to be created and HOG is calculated Scale-Invariant Feature Transform (SIFT) [4] has been extensively used for face but not for emotion recognition.In a recent study Neeru [6] reported 89.67% accuracy on the JAFEE dataset using the algorithm and also proposed an modified version of SIFT achieving 97.65% on the same dataset.

III. THE SYSTEM
The system is divided into two different modules as shown in Figure 1.The first one deals with the training of a classifier and results to a model.This model is used from the web part of the system (second module) for predictions.Based on these prediction the website is customized.

A. Features Extraction and Classification
Initially the original images of the dataset are loaded and for each one of them the face is detected using Viola-Jones [9] algorithm.The detected face is cropped, resized and saved to the disk (this is not an essential part of the process but it can significantly improve the speed later (e.g., during crossvalidation phase); the entire process can be done on-the-fly (as it happens to the web part of the system)).A second Haar cascade detector [9] is used then to detect the eyes on this new image of the face.The detected eyes are also cropped and resized.Since the entire area of the face and the eyes must be clearly described a dense grid of keypoints is applied to both of them.
Every keypoint on the two grids is described by a SIFT descriptor.SIFT features are characterized by a high distinctiveness power and they are invariant to minor affine distortions, noise and illumination changes.In this work we will use only the description (and not the detection) part of the algorithm.For each keypoint a set of orientation histograms is created (4x4 pixel neighborhoods, 8 bins each).These histograms are computed by sampling the gradient magnitude and orientation values around the keypoint (16x16 region).A weight is assigned to the magnitude of each sample drawn by a weighted Gaussian function with σ equal to one half the width of the descriptor window.The values of the histograms forms the vector of the descriptors which is normalized to unit length, thresholded (less than 0.2 threshold value is given on the original paper) and normalized again.The method produces a feature vector with 128 elements for each keypoint.
The resulted feature vectors for the face and the eyes are concatenated to form the final feature vector and the process repeats for the next image.The results is a N xD-dimensional array (where N is number of examples and D is the number of features) (see Table II) which is used for the training of the classifier.
A logistic regression classifier (softmax) is trained in this work.In this model, the probabilities of the possible outcome label for a single example are modeled using a logistic function (Eq.2).The implementation used herein can fit a multi-class logistic regression with L2 regularization (Eq. 1 ) by following the one-vs-rest technique.That mean that a single binary classifier is trained per class.
where g is the logistic fiction: and z i = k w k x ik , with w k , k ∈ {0, . . ., l} the weight for the k th feature and l the number of the features, w 0 the bias weight and C balances the tradeoff between the two terms.
The learnt model is store to the disk in order to be available to the web part of the system.
The proposed approach requires no preprocessing corresponding to pixel intensities.The images are used as they captured by the camera (just cropped and slightly resized).Both the eyes together are detected and handled as a separated single image.Previous approaches (see section II) depended on preprocessing or on facial landmarks in order to work with different parts of the face (e.g, the eyes).In some cases these landmarks should be manual registered.This preprocessing time can negatively affect the total elapsed time of the system when it is finally deployed.It should be noted that even though this is not a critical-time system it remains a real time system.

B. Website
Concerning the client-end of the system the functionality is simple enough.At predefined intervals (and after user's permission) a web camera captures frames from the users while they are visiting the website.Each captured image is sent to the server for processing.As soon as the result (class number -emotion) comes back from the server the interface is changed.On the server-end the learnt model is loaded from the disk and the web application is ready to process the images.
522| P a g e www.ijacsa.thesai.orgFig. 2: Feature Extraction from a Single Image When an incoming image arrives a process similar to the one used for the training of the classifier is applied.The face and the eyes are detected resized and cropped, a dense grid of keypoints is applied, the SIFT descriptors are produced and concatenated (see Figure 2), and the prediction is made.The resulted emotion is sent back to the user-end of the application.
A toy website is built as a proof of concept.This site is only capable of recognizing 3 different emotions (neutral, happy, sadness).These three have been chosen as their facial expressions can last more and they are highly likely to be presented while a user is surfing on the internet.Of course there might be moments that the user is surprised or feels disgust but these emotions change the facial characteristics for a very small period of time which is not justify the change of the environment.A model is also trained to recognize only these three emotions.

IV. EXPERIMENTS AND RESULTS
The system developed using python as programming language and the experiments were conducted on a 2.3 GHz Intel Core i5 mini-Mac system with 8GB main memory.
The Extended Cohn-Kanade (CK+) dataset [5] is used in this work.Currently, the set is one of the most commonly used datasets for facial emotion recognition.Facial behavior of 210 adults from 18 to 50 years of age belonging to different gender and racial groups is shown.23 facial displays (began and ended in a neutral face) are performed by each participant, Image sequences are digitized into 640x490 pixel arrays with 8-bit gray-scale or 24-bit color values.The emotions included in this dataset are neutral, anger, contempt, disgust, fear, happiness, sadness and surprise.

A. Classification
Four different models of the haar cascade detectors for the face and two for eyes where checked.A class creating the dense grid is developed and the SIFT descriptor is used to provide the feature vector for each image.The number of the feature produced are 33792 per image.
A number of linear, non-linear classifiers and ensembles are initially checked to find those who might perform well on the data under investigation.For this phase 80% of the data were used as training set and the rest 20% for testing.Since the dataset is small a 10-fold cross-validation resampling process was applied for the hyper-parameters tuning.
Numerical results (Figure 3, Table I) suggested that logistic regression and linear SVM classifiers were promising for good results and further investigation.Their performance was more or less the same as expected.To improve the results further an exhausted grid search with cross-validation approach were taken.For almost all trials the logistic regression performed slightly better compared to SVM with linear kernel for this specific dataset.To boost even more the performance two ensembles were tested.A voting ensemble combining both classifiers did not improve the results.Then a boosting ensemble for the logistic regression was built and tested but again without any improvement of the results.The logistic regression was finally selected as the appropriate classifier for the dataset.
523| P a g e www.ijacsa.thesai.orgAfter tuning the parameters, the classifier was trained and evaluated using the test set.The numerical results are presented in Table II and the corresponding confusion matrices are depicted in Figures 4, 5.As it is mentioned before, two different models are trained.The first is trained to recognize the full range of emotions in our dataset while the second a reduced set of emotions (in order to be used as an example in the toy website).Thus, two different set of results are presented.As it is shown the method improves the initial accuracy results from 81.81% too 87.10% while reduces the standard deviation from 5.98% to 4.35%.The testing time on the experimentaion system is 0.119sec for 94 images.In this work a system capable of customizing a web site according to its user emotions is presented.Initially, the SIFT algorithm was used to extract descriptors from a dense grid applied on two different images: the face and the eyes.Using these features a logistic regression (softmax) classifier was trained to recognize emotions.No preprocessing to pixels intensities is applied.The images are used as they are captured by the camera in term of illumination, subject pose, etc.After that, the learnt model is loaded on a website application which accepts images of a website's user through a web camera.Three different emotions are used as an example.The toy site reacts to the emotion recognized by changing its L&F as well as the images presented to the user.
The classifier is the key factor in this application.For the Cohn-Kanade Extented (CK+) dataset which used herein a logistic regression classifier has been chosen and tuned.Crossvalidation shows an estimated training/validation accuracy of 87.10% and a testing accuracy of 89.36%.The recognition accuracy goes up to 93% concerning the three emotions the website reacts to.
Further work can be done to improve the classification results for the entire range of emotions included in this dataset.Techniques as Convolutional Neural Networks (CNNs) for this and other bigger datasets can used for models to be trained and tested.Concerning the website, proper usability tests and experiments must be contacted in order determine parameters like the time intervals between the changes of the website interface without frustrating the user or the set of the emotions that must be recognized along with the system's reactions them.

TABLE I :
Initial Result -Comparing the Classifiers

TABLE II :
Classification Results