Face Recognition and Gender Detection Using SIFT Feature Extraction, LBPH, and SVM

-Face recognition and name and gender identification are challenging processes, especially when identifying perpetrators and suspects or when used in authentication systems. Machine learning and computer vision technologies are used in many fields, including security, and play an important role in face recognition and gender detection, offering valuable information to officials to rectify a situation in less time. This study used a few machine learning methods in the Labelled Faces in the Wild (LFW) database to examine their facial recognition and gender detection capacities. The LFW dataset was used to train and evaluate the Scale Invariant Feature Transform (SIFT) feature extraction method along with the Support Vector Machine (SVM) classifier and the Local Binary Pattern Histogram (LBPH) method. The result comparison from the current and other studies showed that the proposed LBPH method had higher accuracy in face recognition, while its accuracy in gender detection was very close to the ones of other, relevant studies.

Abstract-Face recognition and name and gender identification are challenging processes, especially when identifying perpetrators and suspects or when used in authentication systems. Machine learning and computer vision technologies are used in many fields, including security, and play an important role in face recognition and gender detection, offering valuable information to officials to rectify a situation in less time. This study used a few machine learning methods in the Labelled Faces in the Wild (LFW) database to examine their facial recognition and gender detection capacities. The LFW dataset was used to train and evaluate the Scale Invariant Feature Transform (SIFT) feature extraction method along with the Support Vector Machine (SVM) classifier and the Local Binary Pattern Histogram (LBPH) method. The result comparison from the current and other studies showed that the proposed LBPH method had higher accuracy in face recognition, while its accuracy in gender detection was very close to the ones of other, relevant studies.
INTRODUCTION Face recognition is one of the most important computer vision techniques [1,2] and is considered a machine learning process. The ability to recognize human faces is complex in many circumstances, while it has been widely applied for personal identification, smart home access systems, and more. Gender classification is a hereditary technique to identify a person as male or female. Gender recognition is certainly a tough process for computers. Current work focuses on facial recognition and gender classification, which is a binary classification [3]. The current paper studies the use of Scale Invariant Feature Transform (SIFT) to extract features from face images and the application of Support Vector Machine (SVM) to classify face images and obtain a face recognition model [4]. Moreover, the Local Binary Pattern Histogram (LBPH) [5] feature extraction method was applied to the extracted object to create an intermediate image that describes better the original.

II. RELATED WORK
In [6], a new learning-based encoding method was used to encode the microstructures of a face using unsupervised learning approaches, unlike many previous manually created encoding methods (e.g. LBP or SIFT). The Associate-Predict (AP) is a model proposed in [7], built on a separate generic identity dataset that included numerous photos for each identity with a significant intra-personal variation. This study followed strictly the restricted protocol, which included PCA learning and SVM training. A new supervision objective method named "uniform loss" was presented in [8] to learn deep equidistributed representations for face recognition. Most existing methods encourage large interclass distances and small intra-class variations to learn discriminative face features, while the Softmax loss function has been also widely applied. Throughout the experiments, this study used the MXNet package and ResNet as the CNN architecture for all sets. In [9], the widely used SIFT and SURF algorithms were employed, which are widely used in face recognition due to their outstanding ability to handle a wide range of tasks. In [10], a better method was proposed for identifying human faces at various angles, side stances, and tracking during human motion. Furthermore, this study presented the LR500 dataset for training and classification and used the architecture of the LBPH algorithm.
In [11], gender prediction was evaluated from ocular images captured in a mobile environment, using several textural descriptors in combination with SVM and Multi-Layer Perceptron (MLP) on a publicly available large-scale VISOB dataset captured using mobile devices. The problem of detecting gender from faces in real-world images was studied in [12]. Faces from images were extracted, aligned, and represented using the LBPH and a face detector. Adaboost was used to select discriminative features and the boosted LBP features were applied to train an SVM with a recognition rate of 93.29%. The FDREnet for face detection through the histogram of oriented gradients was proposed in [13], using a Siamese technique and contrastive loss to train the deep learning architecture EmbedNet. Face detection and recognition were performed using Viola-Jones, PCA-LDA, and square Euclidean distance. SVM and KNN clustering were also applied in various types of data. A facial recognition application for a biometric system was introduced in [14], based on a Convolutional Neural Network. This study presented a Deep Learning model structure that can improve current state-of-the-art precision and processing time. This method and the proposed CNN achieved high-accuracy performance.

III. METHODOLOGY
This study applied different algorithms for face recognition and gender detection. At first, the SIFT feature extraction was used to extract features from face images and then SVM was applied to recognize faces. Moreover, the LBPH algorithm was applied for face recognition. Two different algorithms were used for gender detection: SVM and LBPH. Figure 1 shows the steps of the methodology. Steps for face recognition and gender prediction using SIFT, LBPH and SVM.

A. Scale Invariant Feature Transform (SIFT) Feature
Extraction Feature extraction is an essential part of a computer vision application that recognizes objects in an image [15]. SIFT was used to extract features from face images, and then SVM was applied to classify the face images and get the face recognition model. SIFT locates the local features of an image that are not affected by operations like object scaling and rotation, by taking an image as input and converting it into a large group of local feature vectors commonly known as the key points [16]. The extracted features are scale and orientation invariant, and they are highly distinguishing the image. This process includes four steps. The first step detects the maxima and minima of a set of Difference of Gaussian (DoG) filters applied at different scales all over the image to compute the locations of probable interest spots with a total of 26 neighbors for each pixel (key point). The positions are then refined by removing low-contrast points. Then, each key point is given an orientation based on local image attributes [17]. Finally, a local feature descriptor is computed for each key point. A SIFT feature extractor was created using the function cv2.feature2d_SIFT() and then 128 features from the face image were calculated.

B. Local Binary Pattern Histogram (LBPH)
The LBPH method was proposed in 2006 and is widely used due to its discriminative power and computational simplicity [18]. The LBP histograms from each sub-region are concatenated into a single histogram with spatial advanced characteristics, defined as: ሺ‫,ݔ‬ ‫ݕ‬ሻ ൌ ݅ሽ ‫ܫ‬൛ሺ‫,ݔ‬ ‫ݕ‬ሻܴ߳ ൟ, The LBPH method was used to train the face recognition model. An LBPH recognizer was created using the function cv2.face.LBPHFaceRecognizer_create() and trained with the training dataset. After training, the accuracy of the model was tested.

C. Support Vector Machine (SVM) Classifier
SVMs are a collection of supervised learning algorithms for classification and regression that are members of the generalized linear classification family [19]. SVM is a binary classification approach that uses the concept of structural risk reduction to identify the best linear decision surface. The decision surface is a weighted mixture of the training set's features [20]. After extracting the features using SIFT, GridSearchCV was used to find the best parameters in the SVM method, and then the SVM model was trained for face recognition.

D. Gender Detection
This detection model was used on the LFW dataset from the Scikit-learn package. At first, the images from the dataset were read to increase the accuracy of the model, and only images of people who had more than five images were used. The SVM and the LBPH models were used with different datasets. The first step in the implementation was to create two separate lists for males and females, and the second step was to detect the gender: if the output was 0, it was male, while if it was 1, it indicated a female.

IV. EXPERIMENTS
This section describes the framework setup and the LFW data overview, which includes information on each attribute, feature correlations, and data pre-processing.

A. Experimental Setup
All algorithms were executed in a PC having MS Windows OS and an Intel Core i7-10510U processor at 1.80GHz. The Jupyter Notebook is a non-profit open-source software that has grown to support collaborative data science. The Python programming language was used to manage and execute the models using Jupyter [21]. The NumPy libraries offer highperformance, easy-to-use data structures, and data processing resources for Python. NumPy was used to convert string to numerical values [22]. In addition, Scikit-learn, a widely used Python-based machine learning library, was used to split the dataset into training and testing [23] sets. As a result, the data were split into 75% for training and 25% for testing.

B. Data Description
The Labeled Faces in the Wild (LFW) database was designed to study the problem of unconstrained face recognition [24]. The database contains 13,233 face images collected from the web. Each image is labeled with the name of the person. The database contains images of 5749 different people, while 1680 people have two or more images in the database. These images are available in 250×250 pixel JPEG files. Most images are in color, although a few are in grayscale. All images are the result of detections using the Viola-Jones face detector [25].

C. Data Pre-Processing
The train-test split is a strategy for testing the output of a machine-learning algorithm and can be used with any supervised learning algorithm for classification or regression problems [26]. The SIFT feature extractor calculated 128 features from each face image. There were no needless or null images that needed to be removed from the dataset. To increase the accuracy of the face recognition model, a subset of the original dataset, that contains people with more than 70 images, was used. On the other hand, in order to increase the accuracy of the gender detection model, a subset of the original dataset was used containing people with more than 5 images. After pre-processing, the dataset was split into the training (75%) and testing (25%) subsets.

A. Experimental Results
After data-preprocessing, the face recognition and gender detection algorithms were applied: • The SIFT feature extraction and SVM classifier were used in face recognition, achieved 65% accuracy in 1288 samples, extracting 128 features from each face image, and using 7 classes.
• The LBPH was applied in face recognition, achieving an accuracy of 88%.
• SVM was applied to detect the gender from the images. The number of samples was 5985, having 2 classes, and the model achieved an accuracy of 82%.
• The LBPH algorithm was used for gender detection, on the same samples, and achieved an accuracy of 91%. Table I shows the result comparison for face recognition and gender detection techniques of the current and previous studies. Comparing the acquired results with the ones of previous studies showed that LBPH had the highest accuracy of 88% on face recognition, while the same method showed a very close to [12] accuracy (91%) on gender detection. The lack of many images per person in the dataset caused some difficulties during face recognition while using SVM, as the method requires a large number of images per person to train.

VI. CONCLUSION
An accurate implementation of facial recognition can recognize human faces for identification or authentication purposes and be utilized in many areas, such as security systems. This study used the LFW dataset to evaluate the use of the SIFT feature extraction technique with the SVM and the LBPH method for face recognition and gender detection. The results showed an accuracy of 65% for SIFT with an SVM classifier, while the use of LBPH had an accuracy of 88% in face recognition, outperforming previous studies. Furthermore, the LBPH offered an accuracy of 91% in gender detection. The accuracy of both face recognition and gender detection methods can be increased by increasing the number of images during training.