Preprint
Article

This version is not peer-reviewed.

A Comparative Study of Machine Learning Classifiers Performance with Feature Extraction for Face Recognition

Submitted:

22 August 2023

Posted:

22 August 2023

You are already at the latest version

Abstract
It is crucial to select the right machine learning classifier for image classification and face recog-nition. This study examines the effectiveness of four different face recognition classifiers - Support Vector Machines (SVM), Random Forest, K-Nearest Neighbors (KNN), and Neural Networks. An analysis of the Large Faces in the Wild (LFW) dataset was carried out using Principal Component Analysis (PCA). Classifiers are rigorously trained and evaluated based on the extracted features. Comparison of classifier performance is an insightful way to figure out their strengths and weaknesses. Having a visual representation of the classifier's performance gives a complete understanding of its capabilities. Through the selection of the most appropriate classifier, study results contribute to advancements in image classification, recognition, and biometric identification. The comparison study demonstrated that the Neural Network classifier was exceptionally accurate and proficient in recognizing faces from the LFW dataset when used in conjunction with PCA for feature extraction. According to the comparative analysis, the Neural Network classifier proved exceptionally accurate and proficient at identifying faces from the LFW dataset when combined with PCA for feature extraction.
Keywords: 
;  ;  ;  

1. Introduction

The potential of facial recognition has been harnessed in a variety of applications, including security systems, biometric authentication, and surveillance. Real-world scenarios, however, can present challenges such as noise, occlusion, lighting variations, and distortions, which can compromise accurate recognition. Choosing an appropriate classifier algorithm is crucial to ensuring accurate and reliable face recognition results. Novel descriptors and classifier techniques have led to advancements in face recognition systems over the years. Principal Component Analysis (PCA) emerges as a vital strategy for dimensionality reduction in face recognition due to its profound importance. PCA contributes to the efficiency and robustness of face recognition systems by effectively compressing facial data while preserving essential discriminative information. With biometrics gaining prominence in security, authentication, and personal identification applications, proper features and classifiers play a key role in enhancing accuracy and reliability. Feature extraction for hyperspectral images is examined in terms of its role in enhancing classification accuracy. Ensemble learning techniques will also be applied to bolster accuracy and robustness in individual identification from images, particularly in the context of facial recognition. The purpose of this study is to explore classifier algorithms that can be used for accurate recognition, while emphasizing PCA as a way to reduce dimensionality to increase efficiency. Furthermore, ensemble learning contributes to improved accuracy and resilience in image-based identification and recognition.

3. Proposed Framework

This study proposes a framework to reduce dimensionality and select the best face recognition classifier using a combination of dimensionality reduction and diverse classification algorithms. Figure 1 shows the sequential steps in the system, beginning with loading the dataset, testing classifiers, identifying the best classifier, and plotting the performance results. A description of the proposed algorithm can be found in Table 1.
An Algorithm 1 describing the steps involved in comparing and analyzing the performance of multiple classifiers for face recognition based on PCA is presented here.
Algorithm 1: Comparative Analysis of Classifier Algorithms
Input: LFW dataset images (X), corresponding labels (y)
Output: Best performing classifier with its accuracy
1: Upload images (X) and labels (Y) from the LFW dataset.
2: PCA features are extracted.
Determine the number of principal components (n_components).
Perform PCA on the images (X) using n_components and whiten=True.
Reduce the image dimensions by transforming it to a pixelated representation (X_pca).
3. Divide the data into testing and training sets.
4. Create multiple classifiers and train them:
Initialize SVM, Random Forest, K-Nearest Neighbor, and Neural Network classifier objects.
5. Create a dictionary 'results' to store accuracy data.
6. For each of the classifiers in 'classifiers':
a. Use X_train and Y_train to train the classifier.
b. Apply the trained classifier to predict X_test labels.
c. Calculate accuracy by comparing y_test with y_predicted labels (y_pred).
d. Keeping accuracy in a data table called 'results' with classifier names as keys.
7. Compare the performance of the classifiers:
8. Display the accuracy of the best classifier.

3.1. Dimensional reduction

By using Principal Component Analysis (PCA), the method extracts features from high-dimensional image data and reduces its dimensionality while preserving important variances. According to Algorithm 2, the graph plots the cumulative explained variance against the number of PCA components. By plotting how much variance is explained by each principal component, 150 was determined as the optimal number of components when reducing dimensionality.
Algorithm 2: PCA-Based Feature Extraction
Input: X (image data), n_components
Output: X_pca (transformed feature matrix)
  • Compute PCA with n_components for image data X.
  • Calculate the transformation matrix by fitting the PCA model.
  • Get X_pca by transforming image data X using the transformation matrix.
  • Then return X_pca.
Figure 2. Plotting the variance of the data by each additional principal component will show how much variance can be explained.
Figure 2. Plotting the variance of the data by each additional principal component will show how much variance can be explained.
Preprints 83048 g002

3.2. Algorithms

The proposed algorithm defines a diverse set of machine learning classifiers and subsequently trains them to recognize faces. Several algorithmic approaches can be utilized for these classifiers, each with its own strengths and weaknesses. In the dictionary 'classifiers', there are four key-value pairs, each representing the name of the classifier, such as Support Vector Machine (SVM) Algorithm 3 shows how this works, Random Forest as shown in Algorithm 4, K-Nearest Neighbors (KNN) based on Algorithm 5, and Neural Network as shown by on Algorithm 6. Classifier objects are instantiated from the respective classes with default parameters. With this selection of classifiers, different approaches to face recognition can be comprehensively evaluated. As these classifiers are trained on PCA-transformed training data, the subsequent analysis aims to identify their performance and suitability for a particular task by gauging their accuracy.
Algorithm 3: Support Vector Machine (SVM) [22]
Input: X_train_pca, y_train (training labels), X_test_pca
Output: y_pred (predicted labels), accuracy
  • Set the default parameters for the SVM classifier.
  • Use X_train_pca and Y_train to train the SVM classifier.
  • Apply the trained SVM classifier to predict the labels for X_test_pca.
  • Calculate accuracy using accuracy_score by comparing y_test and y_pred.
  • Produce a classification report based on the y_test and y_pred data.
  • Return classification_report, y_pred, and accuracy.
Algorithm 4: Random Forest Classifier [23]
Input: X_train_pca, y_train (training labels), X_test_pca
Output: y_pred (predicted labels), accuracy
1. Set the default parameters for the Random Forest classifier.
2. Use the X_train_pca and Y_train functions to train the Random Forest classi-fier.
3. Utilize the Random Forest classifier to predict labels for X_test_pca.
4. Calculate accuracy using accuracy_score and comparing y_test and y_pred.
5. Create classification report for y_test and y_pred using classifica-tion_report.
4. Get y_pred, accuracy, and classification_report.
Algorithm 5: K-Nearest Neighbors (KNN) [24]
Input: X_train_pca, y_train (training labels), X_test_pca
Output: y_pred (predicted labels), accuracy
1. Set the default parameters for the Random Forest classifier.
2. Use the X_train_pca and Y_train functions to train the Random Forest classi-fier.
3. Utilize the Random Forest classifier to predict labels for X_test_pca.
4. Calculate accuracy using accuracy_score and comparing y_test and y_pred.
5. Create classification report for y_test and y_pred using classifica-tion_report.
4. Get y_pred, accuracy, and classification_report.
Algorithm 5: Neural Network [25]
Input: X_train_pca, y_train (training labels), X_test_pca
Output: y_pred (predicted labels), accuracy
  • Set the default parameters for the MLP classifier.
  • Use X_train_pca and Y_train to train the MLP classifier.
  • Use the trained MLP classifier to predict labels for X_test_pca.
  • Calculate the accuracy by comparing y_test to y_pred using accuracy_score.
  • Create detailed classification reports based on y_test and y_pred data.
  • Calculate the y_pred, the accuracy, and the classification report.

4. Experiments and Results

4.1. LFW Database

There are thousands of faces in the LFW dataset [26], representing a diverse range of ages, genders, ethnicities, and facial expressions. As a result of this diversity, this dataset is ideal for evaluating algorithms across a wide range of demographics and environmental conditions. This dataset contains thousands of images taken under a wide variety of lighting, pose, and occlusion conditions. Figure 3 illustrates the challenges presented by this diversity for algorithms.

4.2. Result

Based on PCA-based feature extraction techniques along with the Support Vector Machine (SVM) classifier, the results of the face recognition experiment are as follows in Table 1. Depending on how difficult it was to distinguish individuals, precision, recall, and F1-score varies for each class.
With an overall accuracy of 81%, the SVM classifier is capable of recognizing faces from the dataset when combined with PCA for feature extraction. It is challenging to distinguish some classes accurately than others, however, as performance varies across classes.
Table 1. Support Vector Machine (SVM) performance matrix.
Table 1. Support Vector Machine (SVM) performance matrix.
Preprints 83048 i001
Faces identified by the Random Forest classifier were accurate based on the dataset. Table 2 shows that precision, recall, and F1-score varied for each class due to the classifier's performance in distinguishing individuals.
As evidenced by the 58% accuracy rate, the Random Forest classifier was unable to recognize faces from the dataset satisfactorily, when combined with PCA for feature extraction. It is evident that certain individuals are difficult to distinguish accurately across different classes. As a result of this analysis, the classification approach can be improved in terms of accuracy and efficiency by improving its strengths and limitations.
To identify faces from the dataset, the K-NN classifier is applied. Table 3 evaluates the classifier's performance in recognizing individuals by measuring precision, recall, and F1-score for each class.
The overall accuracy of 69% indicates that the K-NN classifier, combined with PCA to extract features, performed reasonably well in recognizing faces in the dataset. However, classifier performance varies across classes, suggesting that some individuals are hard to recognize. As a result of this analysis, the classification approach's strengths and limitations are made clear, providing a basis for further refining its accuracy and effectiveness.
Neural networks successfully identified faces in the dataset with impressive results. In Table 4, precision, recall, and F1-scores were calculated for each class to evaluate the performance of the classifier.
The Best Classifier for faces was recognized with 85% accuracy using the Neural Network classifier with the PCA feature extraction. A classifier's performance across different classes can also be determined using precision, recall, and F1-score metrics. Moreover, the classifier was ranked as the best classifier among the tested algorithms, with 85% accuracy. Based on the results of the analysis, it is clear that the neural network is capable of identifying individuals accurately and efficiently, making it a strong candidate for face recognition.
Figure 4 illustrates the overall performance of the neural network classifier, combined with PCA for feature extraction, when it comes to identifying faces in the LFW dataset.

5. Conclusions

The aim of this study was to evaluate the performance of four machine learning classifiers in the context of face recognition: Support Vector Machines (SVMs), Random Forests, K-Nearest Neighbors (KNNs), and Neural Networks. Using the Large Faces in the Wild (LFW) dataset, Principal Component Analysis (PCA) was used to extract features. The primary goal of this study was to assess this classifier's efficiency and accuracy in recognizing faces, in order to gain insight into its strengths and weaknesses.
In identifying faces from the dataset, the Support Vector Machine (SVM) achieved an accuracy of 81%. There was a difference in precision, recall, and F1-scores among classes, indicating that discriminating between individuals is difficult at different levels of difficulty. The SVM demonstrated a respectable performance, focusing on precision and recall. A Random Forest classifier, however, was able to recognize faces with an accuracy of 58%. In a similar manner to SVM, the performance varied according to the class. Although the Random Forest classifier presented challenges in certain cases, it showed potential. A K-Nearest Neighbors (KNN) classifier achieved 69% accuracy in identifying faces. There were challenges with precision, recall, and F1-scores in some classes, while there were reasonable results in others. It appears that the system recognizes faces moderately well. In comparison with the other algorithms tested, the Neural Network classifier achieved an impressive 85% accuracy. In most classes, it displayed high precision, recall, and F1-score, demonstrating its accuracy. As a result, the Neural Network, a powerful classifier with real-world applications, was found to be the best classifier overall. The comparative analysis revealed that the LFW dataset was recognized exceptionally accurately and proficiently by the Neural Network classifier combined with the PCA feature extraction. By aiding in the selection of suitable classifiers for face recognition tasks, this study contributes to the advancement of image classification and biometric identification. As a result of this analysis, further refinements can be made based on the strengths and limitations it highlights.

Data Availability Statement

The data presented in this study are publicly available and accessible via the sklearn webpage.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Poon, Bruce, M. Ashraful Amin, and Hong Yan. "Performance evaluation and comparison of PCA Based human face recognition methods for distorted images." International Journal of Machine Learning and Cybernetics, 2011,2, 245-259. [CrossRef]
  2. Karanwal, S. A comparative study of 14 state of art descriptors for face recognition. Multimedia Tools and Applications. 2021 Mar;80(8):12195-234. [CrossRef]
  3. Malakar, S., Chiracharit, W., Chamnongthai, K. and Charoenpong, Masked face recognition using principal component analysis and deep learning. In 18th International conference on electrical engineering/electronics, computer, telecommunications and information technology (ECTI-CON),785-788, May, 2018. [CrossRef]
  4. Sundararajan K, Woodard DL. Deep learning for biometrics: A survey. ACM Computing Surveys (CSUR). 2018,51(3):1-34. [CrossRef]
  5. Liu, Bing, Xuchu Yu, Pengqiang Zhang, Anzhu Yu, Qiongying Fu, and Xiangpo Wei. "Supervised deep feature extraction for hyperspectral image classification." IEEE Transactions on Geoscience and Remote Sensing 56, 2017, 4, 1909–1921. [CrossRef]
  6. Sagi O, Rokach L. Ensemble learning: A survey. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery. 2018, 8, 4,1249.
  7. Kim SK, Park YJ, Toh KA, Lee S. SVM-based feature extraction for face recognition. Pattern Recognition. 2010,43(8),2871-81. [CrossRef]
  8. Wang Y, Li Y, Song Y, Rong X. Facial expression recognition based on random forest and convolutional neural network. Information. 2019, 10(12), 375. [CrossRef]
  9. Almabdy S, Elrefaei L. Deep convolutional neural network-based approaches for face recognition. Applied Sciences. 2019 Oct 17;9(20):4397. [CrossRef]
  10. Akbulut Y, Sengur A, Guo Y, Smarandache F. NS-k-NN: Neutrosophic set-based k-nearest neighbors classifier. Symmetry. 2017,9(9):179. [CrossRef]
  11. Minaee S, Abdolrashidi A, Su H, Bennamoun M, Zhang D. Biometrics recognition using deep learning: A survey. Artificial Intelligence Review. 2023,1-49. [CrossRef]
  12. Lei Z, Liao S, Pietikäinen M, Li SZ. Face recognition by exploring information jointly in space, scale and orientation. IEEE transactions on image processing. 2010,20(1),247-56. [CrossRef]
  13. Song F, Guo Z, Mei D. Feature selection using principal component analysis. In2010 international conference on system science, engineering design and manufacturing informatization 2010 Nov 12,1, 27-30. IEEE. [CrossRef]
  14. Almabdy SM, Elrefaei LA. An overview of deep learning techniques for biometric systems. Artificial Intelligence for Sustainable Development: Theory, Practice and Future Applications. 2021:127-70. [CrossRef]
  15. Dasgupta D, Roy A, Nag A. Advances in user authentication. Cham, Switzerland: Springer International Publishing; 2017 Aug 22.
  16. Phillips PJ, Wechsler H, Huang J, Rauss PJ. The FERET database and evaluation procedure for face-recognition algorithms. Image and vision computing. 1998 Apr 27;16(5):295-306. [CrossRef]
  17. Ayesha S, Hanif MK, Talib R. Overview and comparative study of dimensionality reduction techniques for high dimensional data. Information Fusion. 2020,1;59:44-58. [CrossRef]
  18. Singhal N, Ganganwar V, Yadav M, Chauhan A, Jakhar M, Sharma K. Comparative study of machine learning and deep learning algorithm for face recognition. Jordanian Journal of Computers and Information Technology. 2021,1;7(3). [CrossRef]
  19. Razzak MI, Naz S, Zaib A. Deep learning for medical image processing: Overview, challenges and the future. Classification in BioApps: Automation of Decision Making. 2018,323-50.
  20. Bailey KO, Okolica JS, Peterson GL. User identification and authentication using multi-modal behavioral biometrics. Computers & Security. 2014 Jun 1;43:77-89. [CrossRef]
  21. Wang PS, editor. Pattern recognition, machine intelligence and biometrics. Springer Berlin Heidelberg; 2011 Dec 27.
  22. Wang L, editor. Support vector machines: theory and applications. Springer Science & Business Media; 2005.
  23. Belgiu M, Drăguţ L. Random forest in remote sensing: A review of applications and future directions. ISPRS journal of photogrammetry and remote sensing. 2016,114:24-31. [CrossRef]
  24. Peterson LE. K-nearest neighbor. Scholarpedia. 2009 Feb 21;4(2):1883. Peterson LE. K-nearest neighbor. Scholarpedia. 2009,4(2),1883.
  25. Pinkus, A. Approximation theory of the MLP model in neural networks. Acta numerica. 1999, 8, 143–95. [Google Scholar] [CrossRef]
  26. Huang GB, Mattar M, Berg T, Learned-Miller E. Labeled faces in the wild: A database forstudying face recognition in unconstrained environments. InWorkshop on faces in'Real-Life'Images: detection, alignment, and recognition 2008 Oct.
Figure 1. Visual Framework for Face Recognition.
Figure 1. Visual Framework for Face Recognition.
Preprints 83048 g001
Figure 3. Random Samples from LFW dataset.
Figure 3. Random Samples from LFW dataset.
Preprints 83048 g003
Figure 4. Performance of four machine learning classifiers on LFW dataset.
Figure 4. Performance of four machine learning classifiers on LFW dataset.
Preprints 83048 g004
Table 2. Random Forest performance matrix.
Table 2. Random Forest performance matrix.
Preprints 83048 i002
Table 3. K-Nearest Neighbors performance matrix.
Table 3. K-Nearest Neighbors performance matrix.
Preprints 83048 i003
Table 4. Neural Network performance matrix.
Table 4. Neural Network performance matrix.
Preprints 83048 i004
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.