Facial Detection and Recognition System using LDNP with Two Different Classification Algorithms (SVM, ANN)

Objectives: There is a lot of information available in the human face expressions that reflect ones behavior and condition. Facial expressions are the most natural means of expressing the human condition. In this study, a system was designed using MATLAB to recognize the faces, as well as to know the state of face expression such as happy, sadness, fear, anger, disgust, natural, surprise. Methods/Analysis: The system designed here will be in two basic stages: The first stage is the features extraction using one of the features extraction methods (here the Local Directional Number Pattern LDNP method will be used), to extract the features from the image which input of the system. LDNP, it is a suggested technique for extracting facial features, this technology encrypts information for the face into 8 different directions, by determining the response of the edges in the neighborhood. This method will provide more features extracted from the images, which will reflected on the increase in the accuracy of the classification. The second stage is to classify the features, which extracted from the image using classification algorithms (here will used two different algorithms, SVM and ANN). Classification algorithms will apply separately to the features to compare the results and to determine which is the most accurate in the classification accuracy. Japanese Female Images database (JAFFE) was used in this paper, this database contains seven different classes of Images and the number of images is 200 pictures representing the facial expressions of 10 women. Each image was 256 × 256 pixels. The faces were in front position, to reveal all areas containing useful information. Findings: When using the system proposed in this study, the input image will be classified and categorized according to the type of facial expression, which carried it, so that the images are classified into seven different sets of facial expressions (happy, sadness, fear, anger, disgust, natural, surprise). The system evaluation process is based on the values of the following parameters (Precision, Recall, Time and Accuracy). Improvement: Two different algorithms (SVM, ANN) used to classify the attributes extracted from the image using LDNP. According to the values of the parameters above, LDNP with ANN has been shown to be the best way to detect and distinguish facial expressions.


Introduction
Facial expressions are one of the most important means to allow people to understand each other, so many researchers have studied facial expressions, tried to use artificial intelligence methods to manipulate facial expressions and identify their condition or recognition by comparing them with available face data and Researchers have found good results in this area. As well as the face recognition, system has many benefits, including interaction between human and computer, surveillance, information security, etc 1 -4. For people, facial recognition and expressions tasks are very easy tasks. But for a computer, the subject is so complex because of many variables, such as distance from the camera, direction of the face, lighting, in addition to some special aspects such as beard and hairstyle, however, the face has special and unique features that are not affected by the factors mentioned above. Face recognition will do by analysing the characteristics of a set of images, belonging to the same person. Although the face recognition is easy for humans, but this process becomes tedious and tired if repeated or there was a huge number of images. While by computer, it becomes easier if there is a good system to recognize the face, because the computer has a greater memory capacity than human memory, easy to recall features of the face (although limited those features). There are many previous studies that have touched on this subject, as in 5 , in this method were recognize faces and expressions, where the algorithm was applied to all or part of the face to get features, yet it suffers from the problem of light. LBP 6 -8 , here the researcher suggested a new way to improve the accuracy of face recognition, but this method also suffered from light and noise.In this paper proposed the LDNP method to identify the face because it is strong and effective. Also two different classification algorithms (SNN, ANN) were use separately to compare the results and find out which ones are best. Figure 1 is a diagram explaining the steps to work in this paper. The classification algorithms (SVM and ANN) can be used individually.

Features Extraction
There are many methods, which used to extract features from images to get information about the face, usually the information obtained from the image features, which used to detect and recognize the faces contained in those images, as well as to define facial expressions. LDNP is one of the most important and most accurate ways to detect faces and identify them. The LDNP code for each input face is a six-bit binary; this code represents the density and structure of the face textures. As shown in the previous research, the edges were not sensitive to light variables. In the proposed model, the pattern can be calculated by responding the neighbourhood edge of the compass mask and by selecting the higher directions numbers that are more positive and negative for the response of the edges. The expected information of the structure of the neighborhood depends on the positive and negative responses, because it reveals the gradient trends of the areas of light and dark neighbourhood. Here LDNP can distinguish between positive and negative areas, while other methods may be wrong in distinguishing those areas. LDNP can also distinguish between less and more intense areas, for example the edges of the mouth or eyebrows. The work of the LDNP method can summarized as follows: -Coding Scheme Focus on the directional numbers and encrypts the neighbourhood information in a more efficient way.
-The system uses the sign information to encode more information in small space and differentiate more textures.
-Because the code uses gradient information, making it more powerful against light differences and noises Figure 2.
Here the LDNP code will be generated by calculating the edge response for each mask (M0, M1 ... .., M7), which represents the edges in their direction. LDNP code to the neighbourhood in light area is shown in Figure 3 a., LDNP code to the neighbourhood in dark area is shown in Figure 3b.
The sign information is used to encrypt the most prominent areas (dark or light area) Then, a fixed location is assigned to the positive directional number and the negative directional number as (the three most important bits for the top positive directional number and the three minimum bits in the Where, (x,y) central pixel of the neighbourhood, ix ,y are the directional numbers of the top positive response jx ,y and are the directional numbers of the least negative response. Where II i is the original image convolution, Ι and the i th mask, M i , defined by: The LDNP code generates for the input image by apply LDNP method using MATLAB technical, as given in

2.1.1
The Kirsch mask is used to determine the LDNP code, which is denoted using the LDN k . The mask is rotated (45°) to calculate the responses of the edges in eight Directions (as figures 5a & 5b).
LDNP uses another mask called Derivative-Gaussian. This mask is used to avoid random noise, because this mask makes the codes more stable in case of noise. This mask can be calculated by responding to the smoothed edges of the face. This mask can be defined by: Figure 5a. Matrices masks.
(x, y) represents positions of place, σ represents the Gaussian width. Figure 6 shows Gaussian derivatives mask.

2.1.2
LDNP Histogram (LH) will used to represent rough face information such as edges, spots and local angles (as shown in the

Face Analysis and Recognition
During the face detection process LH and MLH are used, the detection process is performed by comparing the features of the test image with all the features of training images. Comparison is performed using the Chi-Square dissimilarity measure; is a process of calculating the distance between two features vectors. Which can be found out by?
The closest distance between the test image features and training image features is chosen, because the closest distance indicates the match between the test image and the data. Above was referring to face detection, either about the recognition of facial expressions. Face recognition is performed by one of the classification algorithms, here, will be used two different algorithms (each algorithm individually) to classify the features which extracted by the LDNP method and then compare the results to see which algorithms are better in this research, as follows:

Using SVM
Support Vector Machine is algorithm used to classification and regression. SVM is an appropriate algorithm for features classification, which extracted from faces, because it works accurately and efficiently 9 . SVM algorithm builds a surface that separates the data into two classes. This surface called hyperplane (Figure 8), in figure below H represent hyperplane, H1 and H2 two parallel lines that represent the margin (which means the distance between hyperplane and closest data of each classes). The greater margin, means the optimal hyperplane.
To represent the data separation process into different classes taken a training group of M labelled examples T = {(xi, yi ), i = 1,…….., M}, xi∈ Rn and yi∈ (−1, 1), where the test data is classified by: αi represented Lagrange multipliers of the optimization problem, b represents bias and (K) the kernel function. SVM is algorithm used to binary classification. Face recognition it is problem, which need to multi-classification way even can be classified. There are two different ways can be used with SVM to face recognition classification, as follows: one -against -one, way is classification between each pair of classes. The one -against -all, here are the classification process between each class with all other classes. In this study one-againstone technique was used, which can be build k (k−1)/2 classifiers that are trained by data from two classes.

Using ANN
Artificial Neural Network (ANN) is an algorithm that is one of the techniques of machine learning, used to overcome the problem of classification, which is a powerful and efficient technology 10 -12 , is used as classifier to classification such as speech recognition or fingerprint recognition, recognition of faces or recognition of facial expressions. Normally ANN consists of a group of artificial neurons known as (Nodes), these nodes being linked to each other. In this NN, the information will movement in one-way forward, from the input layers towards the hidden layers, and then from the hidden layers to the output layers (Figure 9a).     The Neural Network will learn depending on the adjustment in the weights, to be able to properly classify the training data and then be able to classify the unknown data. NN has the ability to handle incomplete and noisy data. The number of neurons for network input is equal to the length of vector features; the number of hidden layers is 5 layers. It is the best "experimentation in this work", the number of layers of output is equal to the number of facial expressions, namely seven (anger, disgust, fear, happiness, neutrality, sadness and surprise Figure 9b. After feature extraction, will be apply PCA on features vectors to reduce features, this leads to improved performance accuracy, reduces execution time and reduces storage space (As shown in Figure 10).

Results
In this study, the performance of two different algorithms (SVM and ANN) was evaluating under seven facial expressions (classes). The number of facial expressions is 213 and expressed for ten women. The resolution for facial expression images is 256 x 256 pixels. In all the pictures, the face is in front position to take advantage of all areas of the face. To evaluate the face recognition rate,   Table 1 show that the ANN algorithm has a higher resolution than the SVM algorithm in the face recognition process. Table 2 shows the accuracy of the seven facial expressions of each expression individually according to the SVM algorithm. (Figures 11). In accuracy the seven facial expressions of each expression individually is according to the ANN algorithm. To make the results more clearly, MATLAB used to analyze the results (as shown in Figures 12).

Conclusion
In this research, a system was proposed to detect faces and recognize facial expressions by extracting features from the face and then classifying these features. The LDNP method, was used to extract features from the faces in the images, LDNP is one of the best ways to extract features from faces because it is very powerful against lighting as well as strong against random noise, expressions and age and this results in more accurate and reliable results. LDNP works to encode the structure of the neighbourhood region by analysing the directional information, which leads to a response to local neighbourhood edges calculated in 8 directions with compass masks. Compass masks (a derivative -Gaussian and Kirsch) were used to extract information and make the method more powerful in against changes in lighting and noise, after extracting features from the face using LDNP, two different classification algorithms were applied separately to extracted features. SVM and ANN algorithms were used and PCA was used with ANN to reduce features to improve accuracy. It has been shown that ANN is better and less expensive, but SVM has relatively better implementation time. After evaluating the results of the algorithms, it was found that the classification algorithm ANN achieved a accuracy in the recognition of facial expressions (seven classes) by 90%, while the accuracy of the SVM algorithm in the recognition of faces expressions of the same classes was 82%.