{'fraction_non_alphanumeric': 0.031511401397960354, 'fraction_numerical': 0.01737901531645086, 'mean_word_length': 4.795042054006197, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A New Application for Gabor Filters in Face-Based Gender Classification

Human face is one of the most important biometrics as it contains information such as gender, race, and age. Identifying the gender based on human face images is a challenging problem that has been extensively studied due to its various relevant applications. Several approaches were used to address this problem by specifying suitable features. In this study, we present an extension of feature extraction technique based on statistical aggregation and Gabor filters. We extract statistical features from the image of a face after applying Gabor filters; subsequently, we use seven classifiers to investigate the performance of the selected features. Experiments show that the accuracy achieved using the proposed features is comparable to accuracies reported in recent studies. We used seven classifiers to investigate the performance of our proposed features. Experiments reveal that k-Nearest Neighbors algorithm (k-NN), K-Star classifier (K*), and Rotation Forest offer the best accuracies.


Introduction
Gender classification is a research topic with high application potential in areas such as observation, face recognition, witness face reconstruction, image database investigations, and dynamic marketing surveys [35]. Unlike other information inferred from face images, the gender information can be astutely employed to reduce the processing and response times of face-based biometric systems by restricting the face query and matching tasks to a specific gender. Golomb et al. [10] did the first study to recognize gender from faces; subsequently, many studies have been proposed to solve this problem. These studies used different approaches as well as different feature extraction techniques. These approaches are classified into three groups: Holistic matching methods, Feature-based matching methods, and hybrid method [17,40].
These holistic matching methods use the whole face region as the raw input to a recognition system. In this approach, the whole image pixels are used to represent the feature vectors. After that, dimensionality reduction techniques such as Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA), Independent Component Analysis (ICA) are used to decrease the feature size [18,24].
In feature-based matching methods, Local features such as nose, eyes, and mouth are extracted and their locations and local statistics are fed into a structural classifier [7,26]. These methods are based on extracting statistic aggregations from the whole image after filtering the image by Gabor filters. Hybrid methods, just as the human perception system, use both local features and the whole face region to recognize a face [22,31].
Gabor filter is a linear filter used for detecting edges. It has been successfully applied to faced-based gender recognition recently [15,16]. In this paper, we use energies of 24 Gabor filters and extend the set of statistical features reported in previous studies; the extension is mainly meant to overcome the effect of outliers. We applied seven different classifiers to investigate the performance of our proposed features and compared performance.
In section 2 of this paper, we review the prominent studies conducted in gender recognition. Section 3 describes the proposed system including a background on the preprocessing, feature extraction, feature reduction and classifiers used. Section 4 illustrates the setup of our experiments. Results of the experiments are discussed in section 5. Threats to validity and the conclusion along with future work are discussed in sections 6 and 7, respectively.

Literature Review
Many studies conducted in the area of gender recognition since the first study was done in 1990 by Golomb et al. [10]. In this section, we briefly discuss some prominent studies found in the literature.
Jain et al. [18] proposed their technique which extracts ICA features from 500-individuals images to recognize the gender. Support Vector Machine (SVM), LDA, and Cosine Distance Classifier (COS) were used as classifiers. Accuracies reported were 85.33, 93.33, and 95.67% for SVM, COS and LDA, respectively. In the same year, appearance features and local region-based features were used by Abdelkader and Griffin [2]. These features were extracted using two approaches. The first approach applied PCA on a fixed size canonical region of the face. The second approach applied PCA on N different local regions and then concatenated these region scores to generate a single feature vector. SVM and Fisher Linear+Discriminant (FLD) were used as classifiers. All four possible combinations of classifiers and feature methods were validated and the best accuracy was 94.2% by using SVM classification with the second feature method.
Tivive and Bouzerdoum [37] proposed a technique based on shunting inhibitory convolutional neural networks. Face images of 32x32 pixels from FERET and PHUNG datasets were used to investigate the performance of this technique and 97.1% of accuracy was obtained on average. Toews and Arbel [38] proposed a framework to localize and classify faces from arbitrary viewpoints. Scale-Invariant Feature Transform (SIFT) was used to extract the features and Bayesian method was used as a classifier. In 2010, Discrete Cosine Transform (DCT), and Local Binary Pattern (LBP), and Geometrical Distance Feature (GDF) were used to extract features for gender by Mozaffari et al. [29]. These features were validated using Ethnic, AR databases and similarities distance measurement were used as a classifier. A majority role was used as a last step to classify gender images. This rule allowed the GDF to make decision only and only if the results of DCT and LBP features were not equal.
Recently, Logarithmic Gabor filters combined with LBP features were applied by JafariBarani et al. [16] to extract features for gender. Images of 64x64 pixels from AR face database were used and Self-Organizing Map (SOM) was utilized in the classification step. The accuracy of this technique was 90.34%. Moreover, PCA and Discrete Wavelet Transform (DWT) were applied to recognize gender by Biswas and Sil [4]. In their study, two types of features were extracted based on fusion of spatial and temporal features. PCA was used to obtain the spatial features while temporal features were obtained by DWT. The best accuracy was 93% when neural networks were used as classifiers. Another work was proposed by Berbar [3]. Three approaches were proposed to extract features. The first approach used DCT, the second approach was by using the Gray-Level Co-Occurrence Matrix (GLCM), and the third one used 2D-wavelet transform. SVM was used to train models with k-fold cross validation. The best accuracy was given using SVM+DCT.
Further, Jia et al. [19] Studied the difference between Convolutional Neural Networks (CNNs) and a support vector machine approach. LBP was used as a feature extraction technique on Labelled Faces in the Wild (LFW) dataset. Mansanet et al. [27] suggested an approach to recognize gender using the face image called Local Deep Neural Network (Local-DNN).
Local features were extracted by applying Sobel filters and low-pass filter. After that, the yielded image was converted to binary value and then the centers of all local features were extracted.
Our approach uses statistical features extracted from filter images of an image. The dimensionality of these features is very small comparing to [13,15,16]. In addition, the performance of these features are compared with [3] which used the same dataset that are used in this study.

Face-based Gender Recognition Model
Our face-based gender recognition approach is based on the generic model of the pattern recognition system [36] illustrated in Figure 1. Our work focuses on the feature extraction and model blocks that are specific for face-based gender recognition. In the sequel, we discuss the generic model within the context of our system setup and experimentation. We also introduce the classifiers we used in our recognition system.

Preprocessing
A preprocessing activity is always conducted to prepare the images for further processing. This activity typically includes converting colour images to grayscale images; detecting the face region from the image and remove other objects (e.g., hair) and background from the image; and resizing the image to an appropriate size for feature extraction. In our work, we resize the image to 28x28 pixels.

Feature Extraction
In real life, each object has its attributes that distinguish it from other objects. These attributes are called features. Several techniques Features are extracted from images using as discussed in section 2.

Gabor Filter
Gabor filter is a linear filter used for detecting the edge. Frequency and orientation representations of Gabor filters are like those of the human visual system, and they have been found to be particularly Recognized Gender

Sensor
Pre-processing Feature Extraction Feature Selection

Classification Model
Training Testing appropriate for texture representation and discrimination. In the spatial domain, a 2D Gabor kernel is the product of a Gaussian and a cosine or a sine plane wave. The 2D Gabor filter is mathematically formulated as [12]: Where x and y represent the values of a filter of size R×C , f is the frequency of the sinusoidal factor,  represents the orientation of the normal to the parallel stripes of a Gabor function,  is the phase offset, σ is the standard deviation of the Gaussian envelope and  is the spatial aspect ratio.
After preprocessing image, Gabor filters are applied to a face image with scales u=4, and orientations v=6, and the size of filter is 13x13 pixels. The experiments are run by re-implementing Gabor filters several times by optimizing the parameters and the best accuracies are obtained with the following parameters: The Twenty-four filtered images are generated from each image. These filtered images are used to extract the features that used in our approach. Figure 2 shows the real parts of Gabor-filtered images.

Statistical Features
Eight different features from each filtered images are extracted. Two of such features the Arithmetic Mean (AM), standard deviation (s)) were used in [15], and [30]. In our research, we added the six features: Where m is the width and height of the image, n =m*m, and xi is the intensity value of each pixel in image.
The rationale behind extending the features is that the mean and standard deviation, used in [15,30], are affected by outliers. In images, the outliers occur due to the real world illumination changes and variations in direction of the light source which causes a misclassification issue. For mean attribute, median is another central tendency measure that is less affected by outliers. For variance attribute, large outliers will create a higher dispersion that can be reduced by using mean absolute deviation. Gabor filters are convoluted with the signal, using Equation (1) that is based on several parameters, resulting in a so-called Gabor spaces. Hence, due to the complicated equation, using harmonic and geometric mean as a feature is reasonable to represent these spaces. Furthermore, skewness, and Kurtosis are used to support the proposed feature with information of the lack of symmetry, and the lack or the abundance of outliers, respectively.

Feature Selection/Reduction
The objective of this step of feature reduction is to reduce the features size used in training to build a model as well as the testing phase. PCA is one of the most popular statistical procedures used to reduce the number of features [20]. PCA uses an orthogonal transformation to transform correlated variables into uncorrelated variables. Applying PCA on original features of a dataset may allow representing the dataset variables in new component variables [41]. In PCA, the variance of a linear combination of the variables is maximized. The largest variance is included in the first component, the second largest in second components and so on. Generally, in the real problem, the number of components is specified by trying many times and get the best components that give the best result.
The number of features considered in our study is 192. We used PCA to reduce the feature size and the corresponding computational complexity of the machine learning algorithms. The number of Principal Components (PCs) has been selected based on a cumulative percentage of total variation of variances [21] that is calculated by: Where m is the number of eigenvalues selected, n is the total number of eigenvalues, i  is the i th eigenvalue and C is the threshold set which gives cumulative percentage explained by number of selected PCs that is determined by 90%.

Classifiers Techniques
The extracted features are used to distinguish between the patterns by a classifier. The classifier takes the features as an input and maps them to some discrete label. We have used seven classifiers to investigate the performance of our proposed features. In section, we described these classifiers briefly.
 Multilayer Perceptron classifier (MLP): One of the most common classifiers for image classification problem is the MLP built using back-propagation algorithm [34]. The input layer of the network receives the features or the variables extracted from training data. The input of hidden layers and output layer is the weighted sum of the outputs from the previous layer which is calculated using: The "weighted sum:" is then transformed using one of the activation function (such as a sigmoid (12) or hyperbolic tangent (13)) to obtain the output node: Where j  , m , and k are constants.
The weights of each layer are updated during training the model with the generalized delta rule as: is the change of a weight connecting nodes i and j in two successive layers, at the (n+1) th iteration, j  is the rate of change of error regarding the output from node , j  is the learning rate, and a a momentum term. More details of these networks can be found in [1]. In this work, 30 nodes are used in the hidden layer.  Support Vector Machine classifier (SVM): SVM is a classification approach that is used to classify linear or nonlinear data. The first work using SVM was proposed by [5]. The idea of using SVM is based on statistical learning theory [39]. In general, the idea of this classifier is by separating data set of two classes with a maximum distance between them. The performance of SVM classifier differs based on a kernel function and the data of the problem itself. The data that are used to build a model can be linearly separable or non-linear separable. The best kernel function is used with SVM based on the nature of data, separable or not separable. There are many kernel function used with SVM classifier such as Linear, Polynomial, Sigmoid and Radial Basis Function kernels [14]. In this study, we used linear kernel function.  K-Star classifier (K*): K* is one of the lazy type classifier which is an instance-based classifier [35]. The validation phase of using this classifier works based on the training data such as k-nearest neighbors classifier. However, an entropy -based distance function is used as a similarity function. Kstar classify an instance by comparing this instance to database of instances that are processed in the training phase.  Rotation Forest classifier: Rotation forest is one of the multiple classifiers that are proposed in machine learning area [33]. Taking decision based on multiple classifiers can produce more accurate performance than one classifier. This classifier works as following, Let Di is processed using the following steps:  Step 1: Divide the feature set F into K disjointed subsets randomly. Assuming that each feature subset contains M=n/K features.  Step 2: Let Fij be the j th subset of features for training classifier Di, and Xij be the dataset for the features in Fij . For each subset, a nonempty subset of classes is selected from Xij randomly. Then a bootstrap subset of samples is built using 75% of the dataset to create a new training set, which is denoted by Xij . After that, a linear transformation is applied to Xij to produce its coefficient aij in a matrix cij.  Step 3: create a sporadic rotation matrix Ri with the obtained coefficients in matrix cij , as follows:   [28].
 Logistic Model Tree (LMT) Classifier: LMT is a type of tree classifier that is built based on the logistic regression [25]. The logistic regression model is implemented at the leave nodes of a tree.
As it is known that the logistic regression is constructed using the logistic function and its inverse function formulated as Equations (18) and (19), respectively.
Where X= (1,x1,…,xN)   k-Nearest Neighbour (k-NN): k-NN is a simple classification approach used commonly in pattern recogniton field. k-NN was firstly proposed by Fix and Hodges [9] and modified by Cover and Hart [6].
In this method, the similiraty distance between a test sample and each training test samples are computed, and the class label of the sample that produces the smallest distance (the nearest sample) is considered as the class label for the test sample. There are many similarity distance measures, but only one of them has been applied in this study namely Euclidean distance [11] Equation as: where ar is the value of the r th feature on sample x. However, instead of using only the class lable of the closest point, k closest points are considered. In this case, k closest points to the test sample are selected and then the most frequent class among them is assigned to test instance. In this paper, k of 3 has been considered after optimazing it by exploring k=1, 3, 5, 7.

Experiment Design
We conducted some experiments to investigate the performance of our proposed method. In the sequel, we discuss the dataset we used as well as the metrics we employed to evaluate the performance.

Datasets
We used three different popular databases in our experiments: Faces 94, faces95 and face96, that are available at http://cswww.essex.ac.uk/mv/allfaces/. Table 1 describes the characteristics of each dataset. For the sake of validation, we compared our results against Berbar [3] results. Berbar used AT@T, Faces94, UMIST, and colour FERET in his study. Table 1 describes the characteristics of those additional databases we had to use for the sake of comparison.

Performance Metrics
To evaluate the performance of our feature set, we used several measures from Fawcett [8]. These measures are classification accuracy, sensitivity, specificity, positive predictive value, negative predictive value, and confusion matrix. A confusion matrix includes information about actual and predicted classifications done by a classification system is also used. Table 2 shows the confusion matrix of a binary classifier. We also use the Receiver Operating Characteristic (ROC), or ROC curve, graphs. ROC is two-dimensional graphs in which TPR is plotted on the Y axis and FPR is plotted on the X axis. A ROC graph shows the relative trade-offs between benefits (true positives) and costs (false positives).

Experiments and Results
In this study, seven classifiers are applied on different databases to show the performance of the proposed features. Table 3 shows the accuracies of the first experiment that used 3 datasets and their 4 combinations. These accuracies are calculated by applying 10-fold cross validation. The value in each cell is the mean accuracy of the 10-fold ± the confidence interval with respect to 0.95 confidence level. In this work, all 7 classifiers are applied using Weka 3.6 framework. The default values of each classifier's parameters are used except MLP and k-NN classifiers. In MLP, the number of hidden layers is 30 and the k is equal 3 in k-NN (3-NN). As we mentioned before, all images in all datasets are resized to the same size (28x28 pixels) and the number of features is 192 features. The results of each type of combination are discussed separately.

Results of Single Datasets
Three single datasets (Faces94, Faces95, and Faces96) are applied in this study. These datasets contain 2631, 946 and 1803 images, respectively. The number of male images of each dataset is 2231, 701, and 1573 respectively and the number of female images is 400, 245, and 230 respectively. The highest accuracies of using Faces94, Faces95, and Faces96 datasets are 99.96±0.09, 98.73±1.17 and 99.83±0.19 respectively. These accuracies are obtained using 3-NN and K* classifier on Faces94 dataset, Rotation Forest on Faces95 dataset, and 3-NN with Faces96 dataset. However, the difference between the accuracies of the classifiers with the same dataset is too small. So, it can be concluded that the good results are due to the significant of the proposed features to determining gender.

Results of Comb1, Comb2 and Comb3 Datasets
In this section, three combination datasets are used. The two-combination datasets contain 3577, 4434, and 2549 for Comb1, Comb2, and Comb3 respectively. The number of male images is 2932, 3804, and 2274, and the number of female is 645, 630, and 475 respectively. The highest obtained accuracy using these combinations is 99.64±0.28, 99.89±0.11, and 99.42±0.33 for Comb1, Comb2, and Comb3 respectively. These results are obtained using 3-NN classifier on Comb1 and Comb3 while K* is used on Comb2. However, the difference between the accuracies of the classifiers with Comb1 and Comb2 is smaller than Comb3. This is because the variation of illumination of Faces94 and Faces96 datasets is the smallest, and the variation of the illumination of Faces95 and Faces96 is the most. The difference may be reduced if an illumination normalization technique is applied to enhance the image.

Results of Comb4 Dataset
The last combination Comb4 contains 5380 images. The number of male images is 4505, and the number of female images is 875. The highest accuracy obtained using this combination is 99.61 ± 0.23. This accuracy is obtained using K* classifier. In this combination, the difference between the accuracies of the classifiers with Comb4 is the highest comparing to all other combinations. This informs that the variation of the illumination of Faces94, Faces95 and Faces96 datasets is the highest. In addition, we use the Area Under the Curve (AUC) performance metric here to show that the performance of our model is not by chance. The area under the curve of each classifier with each dataset are illustrated in Figures 3, 4, and 5, for 10-fold, 5-fold, and 2-fold cross validation, respectively. From these figures, it is noticed that all models built using the 7 classifiers in 10-fold, 5-fold, and 2-fold cross validation produce AUC between 90% and 100%. This implies that if the number of images in each class, male or female, is not balanced, the performance may not be effected. Table 3. The accuracy of 10-fold cross validation.

Comparison with Previous Studies
We conducted experiments using the datasets AT@T It is the another name of AT@T dataset, (ORL) and UMIST in addition to Faces94 to compare with Berbar work [3]. Table 4 displays the number of images that were used in [3] compared to the number of images used in this study. We did not use all images because the face detection algorithms could not detect the face region from the original image. Moreover, we could not apply the proposed approach on FERET dataset because we do not have access to this dataset. Table 5 displays the comparison of the average of the accuracies of 2-, 5-, and 10-fold cross validation between our approach and Berbar approach. SVM classifier was used in Berbar study while 3-NN classifiers is used in this work. Table 5 shows the comparison between our work and Berbar work before and after reducing the number of features. From Table  5, it can be concluded the following; before reducing the feature size, our approach produces better performance in all experiments except when using ORL dataset in 2fold, and Faces94 dataset in 5-fold. When the feature size is reduced, our approach produces better performance when we used Faces94 dataset in 2-fold and 10-fold. However, Berbar approach produced better than ours when ORL and Faces94 datasets are used in 2-fold and 5-fold, respectively. Moreover, the two approaches produced the same performance when UMIST dataset is used. Table 5 shows that our proposed features have produced a better accuracy with respect to the feature size.

Threat to Validity
 External validity: In our experiment, we only used 5 small datasets which represent only few humans. Accordingly, we cannot generalize our conclusions from the experiment because the characteristics of human faces differ based on races, regions, etc. In addition, the tool we used to detect and extract the face from original images produced few mistakes with some images. It extracted few incorrect faces from original images.  Internal validity: The face databases that we used have similar characteristics regarding: head scale, image lighting variation, expression variation, turn, tilt and slant, translation and glasses/no glasses. However, other datasets may have different noise such as wearing scarf or some incomplete images. So, if the input features are changed, the results may be changed.

Conclusions Future Work
In this paper, a modified feature extraction technique is proposed based on the statistical aggregation. These features are extracted from energies generated using Gabor filters. The performance of these features is investigated using 5 face datasets and 7 classifiers. These features provide significant performance to recognize gender from facial images with accuracy between 96% and 100%. The best performance is obtained by using 3-NN, K* and Rotation Forest classifiers. In addition, when the datasets are combined with more than one dataset, the performance is almost not affected.
Our future work will consider using illumination normalization technique before applying our proposed work. We will also consider using another larger dataset for training and testing such as GBU [32] dataset.