Comparison Of Feature Extraction Algorithms For Gender Classification From Face Images

DOI : 10.17577/IJERTV2IS50636

Download Full-Text PDF Cite this Publication

Text Only Version

Comparison Of Feature Extraction Algorithms For Gender Classification From Face Images

Vandna Singh

Dr. Vinod Shokeen

Mr. Bhupendra Singh

M.Tech , Scholar Asst. Professor III Asst. Professor I

ECE Department Amity University Noida, India.

ECE Department Amity University Noida, India.

ECE Department Amity University Noida, India.


Gender Classification is the hot research topic from last two decades but still a gap exist between the requirements and actual performances. This gap lies due to the variation in pose, expression and illumination condition etc. Gender classi- fication of face images is the process of identification of gender by their facial images. In this paper we compared the performance of two feature extraction algorithm i.e. Local binary pattern (LBP) and Histogram of oriented gradient (HOG) in order to determine the more efficient approach for gender classification from face images. Haar Cascade Classifier is used for the face detection from an image. Histogram equal- ization normalization technique is used for normalizing illumination effects. Support vector machine (SVM) is used as a classifier for gender classification. We implement gender classification system architecture using OpenCv 2.4.2. Indian face database (IFD) is used for the experiment . Experimental results on Indian face database show that HOG is more efficient approach for gender classification and improves gender recognition rate upto 95.56%.

Keywords- Gender classification, Haar cascade classifier, Histogram of oriented gradient, Local binary pattern, Support vector machine.

  1. Introduction

    A person is a male or female is an easy task for human to recognize but it is very difficult for a machine or robot. Gender identification using voice of a person is comparatively easier than that from facial images. This is a binary classification which is useful in many applications such as targeted advertising, surveillance system, human machine interaction, content based indexing and searching, demographic collection, biometrics etc.

    In the present scenario identification of a face, gesture recognition and gender classification plays an important role in order to meet the secure, realible and individualized services [1]. In the previous time , gender recognition is based on the cognition and psychology regions [2,3] but in present time people began to start thinking about this problem more technically. Now, the gender recognition is receiving more and more attention.

    Gender classification research started in 1990s. Golomb et al [2] and Cottrel and Metcalfe [3] first used the face images manually and used neural network classifier to classify the gender. Generally features can be broadly classified into 2 categories: geometric based feature and appearance based feature. They are also known as local feature and global feature respectively. Appearance based methods are based on the pixels in an image and geometric based methods are related to various properties of face such as eyes, nose, chin, eyebrow etc. Many feature extraction methods have been used for the classification of gender. The global feature method which we present in this paper has the potential to identify the gender.

    Baback Moghaddam and M.H.Yang [12] adopt Support vector machine (SVM) for the recognition of gender and RBF network ,FLD, Minimum Vicinity classifier have compared for gender recognition. FERET image face database is used for this purpose. Results showed that SVM classifier performs best. So in this paper SVM is used as a classifier to classify the gender but there gray image is directly used for testing which are not affected by the illumination variation. In this paper Histogram equalization is used to equalize the illumination effects for colour images.

    Firsty, Haar cascade classifier is used for the face detection from an image. Secondly, histogram equalization is applied to equalize the illumination changes. Thirdly, LBP and HOG feature methods both are applied for the facial feature extraction.

    Finally, Support vector machine (SVM) is used to classify the image whether it is a male or female. We observed that if we used HOG for the feature extraction then get more accurate result than LBP. The remaining paper is setup as follows: Section II describes the proposed method and section III describes experimental results. Finally, conclusion and future work is discussed in last section.

  2. Proposed method

    The proposed method for the gender Classification system as shown in figure 9 is as follows:

    1. Face detection

      Before the feature extraction process we must extract the face region from image. The face region is extracted using haar cascade classifier. In the terms of speed and reliability, it is one of the best detector.

      1. Haar cascade classifier

        In this paper, Open Source Computer Vision Library (OpenCv) [4] is used to implement the haar cascade classifier. Haar classifier originally given by viola and jones [5] for the detection of the visual object. Haar like feature is the main part of haar cascade classifier for object detection. They introduced rectangle features for rapid face detection. some haar like feature are shown in figure 1. The sum of the pixel which lie within the white rectangle are subtracted from the sum of pixels in the gray rectangle in order to calculate the value of the haar feature. Haar feature results in a single value.

        Figure 1. Haar features

        The Haar feature is applied to an image for the face detection from the top left corner and it ends at the bottom right corner of the image as shown in figure

        2. This process repeats several times with a different subimage size.

        Figure 2. Image is scanned from top left corner to the bottom right corner.

        Integral image representation can be used to compute the rectangle features rapidly. Integral image allows for the calculation of sum of all pixels inside any given rectangle using only four values at the corners of the rectangle. In an integral image the value at pixel (x,y) is the sum of pixels above and to the left of (x,y).

        As shown in figure 3 sum of all pixels value in D:

        S1=A, S2=A+B, S3=A+C, S4=A+B+C+D S1+ S4- S2- S3=A+A+B+C+D-A-B-A-C=D

        Figure 3. Calculation of integral image

        The face detection can be performed by a cascade as shown in figure 4. The job of each stage is to determine whether the given image subregion is a human face or not. If it passes all condition then it is a human face otherwise if it fails in any of the stage, immediately discarded [15].

        Figure 4. Cascade classifier

        Figure 5 shows the result of the haar cascade classifier. The first row shows the male faces and

        second row shows the female faces extracted by haar cascade classifier.

        Where Hc is the center value and Hp = (p=0, 1,2) is the neighbourhood of Hc and S define the thresholding function as follows:

        S ( Hp

        – Hc

        1, Hp Hc

        ) = 0, Hp < Hc


        Figure 5. Faces extracted by voila and jones method

    2. Illumination normalization

      In real life, varying illumination is one of the difficulties for gender classification. In order to increase the recognition performance illumination normalization is performed. In the literature, many methods have been proposed for the gender classification based illumination invariant features of the face images. In this paper, we apply histogram equalization method [13] [14].

      Histogram equalization is a method that improves the contrastin an image in order to stretch out the intensity range. Histogram equalization normaliza- tion technique is applied to all the feature images extracted in both testing and training datasets. OpenCv [4] is used to implement histogram equalization.

    3. Facial feature extraction

      In this paper, LBP and HOG feature are used for the extraction of the facial features, based on pixels in an image for the recognition of gender.

      1. Local binary pattern

        The LBP operator is a image texture operator firstly proposed by Ojala et al [6] and later showed high performance for facial recognition [7]. LBP are features that are find out from the intensity of the pixel in a pixel neighbourhood. In start LBP was defined for 3*3 pixel neighbourhood which cannot capture the dominant features with large scale structure so later it was increased to different neighbourhood [19] of different sizes.

        To calculate the LBP feature vector of image always divide face image into 8*8 pixels block. As shown in figure 6. Select one pixel as center, if center pixel value is greater than neighbour write

        1 otherwise write 0. This gives the 8 bit binary number 10001001(decimal equivalent 137). The value of the LBP code of a pixel (xc ,yc) is given by:



        LBP = 7=0 S Hp Hc 2p (1)

        LBP is called uniform it contain 1 to 0 or vice versa at most two bit wise transistion, when the binary string is considered circular. For example 11111111, 11100011 are uniform pattern and 10101001 are not. LBPu2 refers to the LBP operator with uniform patterns in a neighbourhood size of P equally spaced pixels on a circle of radius





        R. LBPP,R refers to the LBP operator without uniform patterns in a neighbourhood size of P equally spaced pixels on a circle of radius R. For example, the number of levels for a neighbourhood of 8 pixel is 256 for standard LBP but 59 for LBPu2

        Face images is the composition of micropattern which can be effectively described by the LBP histogram. Therefore, it is intuitive to use LBP features to represent face images. Face images were equally divided into regions to R0, R1 ……Rm to extract LBP histograms [20]. Compute the histogram over the cell and optimally normalized the histogram. Concatenate normalized histogram of all cells as shown in figure 7. This gives the feature vector and now this feature vector processed using SVM to classify the test image for gender classification.

        Lian and Lu [8] used LBP with SVM for multiview gender classification. Yang and Ai [9] applied it for classifying age, gender and ethnicity.

        Figure 6. Basic LBP operator

        Figure 7. Feature histogram calculation

      2. Histogram of oriented gradient

        HOG features were initially developed for the pedestrian detection [10] but here we have used HOG feature for gender classification [17]. This technique counts occurrences of gradient orientation in localized portions of an image. We have implemented HOG feature using open source computer vision library [4]. Implementation of this method can be divided into following stages:

        1. Image normalization: It is suitable to normalize the input image in order to make the descriptor less sensitive to the illumination changes. We apply a histogram equalization normalization technique to the intensity values so that whole range of the intensity values (i.e., values from 0 to 255) is represented in the normalized image.

        2. Gradient computation: Gradient is Computed by applying convolution between the normalized image and the filter [-1,0,0] in both of the vertical and horizontal directions. The gradient is represented by the magnitude M(x ,y) and an angle (x ,y).

        3. Creating cells: Dividing the image into the small connected region, called cells, for each cell compiling a histogram of gradient directions for the pixels within the cell. The whole image is divided into cells of square grid whose edges are formed by cellSize pixels.

        4. Cell histogram computation: The gradient in Cell are histogramed. Let hi where i=1,2,………..n Bins denote histogram bins and (hr, hq) denote the smallest possible interval where angle (x, y ) fits. Every pixel with an angle and magnitude votes into histogram bins hr , hq by a linear combination.

          x ,y hq

          H(r) = H(r) + hq hr M(x ,y) (3)

          H(q) = H(q)+ hq x ,y M(x ,y), (4)


          Where hr x ,y)< hq

        5. Creating block: Two main block geometry exist: rectangular R-HOG block and circular C- HOG block. In this paper R-HOG block is used. Blocks have the squared shape and their edge is formed by block size. Overlapping Concept of block is used to improve accuracy.

        6. Normalize block histogram: A block histo- gram is formed by all its cell histogram.

        7. Stacking histogram together: All block histograms are stacked together into one feature vector .

        The final step in gender classification using Histogram of oriented gradient is to feed the feature vector into Support vector machine [11].

    4. Support vector machine

      Support vector machine (SVM) proposed by vapnik and cortes [11] have been successfully applied for gender classification problems [12] by many reasearchers. An SVM classifier is a linear classifier where the separating hyper plane is chosen to minimize the expected classification error of the unseen test patterns.

      SVM is a strong classifier which can identify two classes. SVM classifies the test image to the class which has the maximum distance to the closest point in the training. SVM training algorithm built a model that predict whether the test image fall into this class or another.SVM require a huge amount of training data to select an affective decision boundary and computational cost is very high even if we restrict ourselves to single pose (frontal) detection.

      In this paper, face images pixels were used as a input for SVM. It is trained with the histogram equalized image pixels, the intensity of which were scaled to -1 to +1 range. In the literature many kernel functions have been proposed but linear kernel was used in this paper due to its popularity We used LIBSVM (Chang and Lin, [18]) for training of SVM and find the gender classification accuracy for LBP and HOG feature.

  3. Experimental results

    OpenCv 2.4.2 is used to implement the gender classification system architecture as shown in figure 9.

    1. Face database

      Indian face database [17] are used for the experiment. The size of each image is 640×480. we have taken 366 frontal face images containing both male and female. 37 male image and 29 female image are used for training. The images in training and testing are different. In testing we have taken 300 images including 192 male images and 108 female images. All images are frontal face images. Some images of Indian face Database are shown in figure 8. First row contain the male images and second row contain the female images.

      Figure 8. Sample images from Indian database.

      As database is divided into training and testing image and there is no overlapping between both datasets. The gender classification system architecture is as shown in figure 9.

      Figure 9. Gender classification system architecture

    2. SVM classification result

      The peak point of the recognition rate of feature extraction method was achieved, when the number of training images were 66 including 37 male images and 29 female images. Figure 10 shows that 89.43% accuracy is obtained for LBP feature at 66 number of training images.

      Figure 10. Performance of LBP method

      Figure 11 shows that 95.56% recognition rate is

      acheived for HOG feature at 66 number of training images.

      Figure 11. Performance of HOG method

      The training and testing dataset ratio for the SVM classification is shown in table I.

      Table I Indian face Database (FD)

















      Table II Summarize the accuracy comparison of feature extraction methods

      Table II Performance comparison

      Feature extraction methods

      Male accuracy (%)

      Female accuracy (%)

      Total (%)









      Feature extraction method

      Male Error Rate(%)

      Female Error Rate(%)







      Feature extraction method

      Male Error Rate(%)

      Female Error Rate(%)







      Male and female error rate are shown in Table III Table III Male and Female error rate

      Figure 12 shows the correctly classified gender classification results

      Figure 12. Correctly classified gender classification results

      Figure 13 shows the gender classification results which are not correctly classified.

      Figure 13.Gender Classification failure result

      From Table II and figure 11 it is clear that HOG feature is more efficient and accurate for gender classification from face images.

  4. Conclusion and Future work

In this paper, a comparison between feature extraction methods is presented, based on pixels for the classification of the gender. From the experimental point view it is clear that HOG feature gave more accuracy or more accurate result than LBP for gender classification. So HOG approach is more efficient and more accurate. To handle the large datasets haar cascade classifier prove to be fast enough. Even the image is affected by illumination variation, gender classification results are more accurate using HOG feature.

Our future work concentrate to implement these feature extraction methods for real time gender classification system.


  1. Z. Xu, L. Lu, and P. Shi, A hybrid approach to gender classification from face images, in Pattern Recognition, 2008. ICPR 2008. 19th International Conference on, 2008, pp. 14.

  2. Golomb, D. T. Lawrence, and T. j. Sejnowski. SEX-NET: A neural network identifies sex from human faces. In Advancds in Neural Information Processing Systems, pp. 572-577, 1991

  3. G. w. Cottrell and J. Metcalfe. EMPATH: Face, emotion, and gender recognition using holons. In Advances in Neural Information Processing Systems, pp. 564-571, 1991

  4. Open source computer vision library

  5. P. Viola and M. Jones, Rapid object detection using a boosted cascade of simple features, in Computer Vision and Pattern Recognition, 2001. CVPR 2001. Proceedings of the 2001 IEEE Computer Society Conference on, 2001, vol. 1, pp. I-511-518.

  6. Ojal T.,Pietikinen M. and Harwood D.,A Comparative Study of Texture measures with classification based on featured distributions, Pattern recognition, Vol 29,No.1,PP. 51- 59,1996.

  7. T.Ahonen ,A.Hadid and M.Pietikainen,Face recognition with Local Binary Pattern. In the Eur. Conference on Computer vision, pages 469-481,2004.

  8. B. Xia, H. Sun, and B.-liang Lu, Multi-view Gender Classification based on Local Gabor Binary Mapping Pattern and Support Vector Machines, in Neural Networks, 2008. IJCNN 2008.(IEEE World Congress on Computational

    Intelligence). IEEE International Joint Conference on, 2008, pp. 3388-3395.

  9. Z. Yang and H. Ai, Demographic classification with local binary patterns, Advances in Biometrics, pp. 464473, 2007.

  10. N. Dalal and B. Triggs, Histogram of oriented gradient for human detection, In Conference on computer vision and pattern recognition, pages 886-893,2005.

  11. C. Cortes and V. Vapnik, Support-Vector Networks, Machine learning, vol. 20, no. 3, pp. 273297, 1995.

  12. B. Moghaddam and M. Yang, Gender Classification with Support Vector Machines, Fourth IEEE International Conference on Automatic Face and Gesture Recognition, pp. 306311, 2000.

  13. S.M.Pizer and E.P.Amburn, Adaptive histogram equalization and its ariations, Comput. Vis. Graph., Image process.,vol 39,no.3,pp.355-368,1987

  14. Shan, W.Gao, B.Cao, and D.Zhao, Illumination normalization for robust face recognition against varying lighting conditions, in Proc. IEEE Workshop on AMFG,2003,pp 157-164.

  15. Erno and Roope An experimental comparison of gender classification methods, Pattern recognition 2008,pp:1544-1556.

  16. Indian database downloaded from http://vis-

  17. gradients

  18. Chang, C .C.,Lin ,C.J. LIBSVM: a library for support vector machines, http://www.-

  19. T.Ojala.,M.Pietikainen,T.Maenpaa,Multiresol

    -ution gray-scale and rotation invariant texture classication with local binary patterns,. IEEE Transactions on Pattern Analysis and Machine Intelligence vol24 pp. 971-987,2002

  20. Shan,Gong and McOwan, Facial expression recognition using local binary pattern: a comprehensive study, Image and vision computing (2009) 803-816.

Leave a Reply