Neural Network based Age and Gender Classification for Facial Images

— Automatic face identification and verification from facial images attain good accuracy with large sets of training data while face attribute recognition from facial images still remain challengeable. Hence introducing an efficient and accurate facial image classification based on facial attributes is an important task. This paper proposes a methodology for automatic age and gender classification based on feature extraction from facial images. In contrast to the other mechanisms proposed in the literature, the main concern of this methodology is the use of biometric feature variation of male and female for the classification. It uses two types of features namely, primary and secondary features and it includes three main iterations: Preprocessing, Feature extraction and Classification. This study has been carried out using facial images of age range 8-60 years consisting of both gender types and the age classification has been done according to predefined age ranges. Proposed solution is able to classify images in different lighting conditions and different illumination conditions. Classification is done using Artificial Neural Networks according to the different shape and texture variations of wrinkles on face images. This study has been evaluated and tested on both foreign and Asian face images in both gender types and the four age categories used.


I. STEP 1: INTRODUCTION
Personal monitoring, identification and verification using facial images are known to be an actively growing area of research in many computer vision applications.Some examples in this area are face recognition, face action classification, poses recognition, skin colour classification, age estimation, gender recognition and ethnicity recognition.Face recognition has achieved better results according to the research done for nearly three decades [1], [2] and [3].However, similar accuracy of classification could not be gained from facial attribute recognition [4].
Human brain is the most powerful and accurate classifier in pattern recognition.It has the brilliant power as it is a dynamic organ involved with training and learning for a specific period of time.Researchers' main attempt is to convert this biological and behavioural characteristic of human brain into artificial neurons in order to attain the same or better results.One of the primary uses of this work is to classify human attributes like age, gender and ethnicity using facial images.Main attempt in this research is to come up with an accurate method for age and gender classification from facial images.
Gender classification is done according to the geometric difference of primary features in male and female [11].This algorithm can classify the facial images in to four age groups 8-13, 14-25, 26-45 and 46-60.Age classification is based on the texture variation of wrinkle density in the forehead, eye lids and cheek area.Classification is done using two separate neural networks for age and gender.
The dataset used for the proposed methodology contains images from both genders and different age groups.Those images represent different facial features, expressions, different angles and different lighting conditions.Fig. 1. shows a subset of data used in the experiment.The system uses face images from the famous facial databases like FERET database [12], FGNET database [14] and some images are collected by the authors as well.Researchers must request from authorized people to download the FERET and FGNET databases.All the instructions to download FERET database can be found in [15].
The rest of the paper is organized as: Section II describes the related work carried out in the research area; Section III describes the design used in the proposed methodology with the limitations and constraints descriptively; Section IV includes the results of the proposed methodology; Section V includes a discussion on the results of the methodology and Section VI includes the acknowledgements and then the references used in the paper.

A. Age Classification
The very first involvement carried out on age classification from facial images has done in 1996 by Y. H. Kwon and Niels da Victoria [4].Images were classified into one of the three age groups from babies, young adults and senior adults.Primary features of the face are used to distinguish a baby from a young adult and a senior adult.After that wrinkle geography mapping is used to distinguish seniors from young adults and babies.
Wen-Bing Horng et al [5] developed an algorithm to identify age from grayscale images by using an Artificial Neural Network (ANN) classifier.Proposed method is able to classify images into one of the four categories from babies, young adults, middle-aged adults, and elderly adults.
K B Raja and L M Patnaik [6] proposed an age and gender classifier using ANN classifiers and posterior class probability.The algorithm consists of three main stages, preprocessing, feature extraction and classification.
Feng Gao and Haizhou Ai [7] developed their own algorithm to face the challenge of age classification using consumer images in various conditions.Gabor feature is extracted for face representation and a fuzzy version of Linear Discriminant Analysis (LDA) is used for classification.

B. Gender Classification
Rodrigo Verschae et al [8] described a framework for classifying face images into the corresponding gender using Adaboost and domain-partitioning based classifiers.The proposed framework has the capability of building classification systems with high accuracy in dynamical environments, while maintaining a high processing and training speed.The paper presents that they have practiced the proposed framework by using several features like Local Binary Patterns (LBP), wavelets and rectangular features.
M. Mayo and E. Zhang [9] presented a novel method of face gender classification by using completely misaligned data such as translated or rotated data into the training set and obtained a remarkable accuracy.Proposed methodology used two classifiers for the experiment.One is based on weak features such as Local Binary Pattern histograms and the other classifier is based on SIFT key points.Finally the proposed system has achieved a high accuracy of 92.5%.
Wei Gao and Haizhou Ai [13] introduced a novel method in classifying face images in multiethnic environment by using consumer images.They have used Active Shape Model to overcome the non uniformity in consumer images by texture normalization.They have presented a probabilistic boosting tree approach in gender classification as well as consideration on ethnic factor on classification.The paper proves that gender classification using ethnic factor has achieved a higher accuracy of classification in multi-ethnic environment.

C. Different Methods used in the basic iterations
Accurate classification of facial features is an important task because the extracted feature set will contain only the relevant information from the input data in order to perform the desired classification task using the reduced representation of the input image.First step is identifying the primary features such as eyes, eye brows, nose, mouth and face area and mark some points from these areas to calculate the ratios used in the classification.Fig. 2. represents 66 landmarks identified in human face according to the FGNET database.Fig. 2. Facial landmarks according to FGNET database [10] The following approaches have been used for feature extraction according to the literature: • Sobel edge operator -Sobel edge operator is a well-known method used to calculate the gradient magnitude of each and every pixel in a grayscale image.Sobel edge operator uses two convolution kernels with n*n elements.One corresponds to the horizontal direction and the other one is the 90 o rotated matrix of the first matrix which corresponds to the vertical direction.Sobel gradient magnitude seems to be slower in the computation and sobel is less sensitive to noise as the convolution kernel smooths the input image [4].• Am-markup tool -This is a tool which can be used with Active Appearance Models for interactive search.This tool can be used to locate facial feature points efficiently according to [10].• Active Shape Model -This is a statistical model for different shapes which can deform iteratively up to a given object in that shape.It is an improved edge finding technique which is used for texture normalization [16].This approach is very useful for face representation when the data sample consists of consumer images where the images are of various backgrounds and illumination conditions [17].According to literature, there are many different mechanisms used for the classification process.Some of the major mechanisms in age classification are discussed below.
• Neural networks -Neural network based classification methods are the frequently used mechanism for age classification according to the previous research work [4], [10].Main emphasis is to feed and train the human brain functions into the computer for pattern recognition.Human brain is the best classifier in pattern recognition as it has been trained and learned for several years.
• Fuzzy Linear Discriminate Analysis(FLDA) -FLDA is another age based classification method experimented by some researches by combining with fuzzy age membership function and provide better results [7], [18], [19].Face representation need for FLDA is done using Gabor feature extraction.LDA is a dimensionality reduction approach used to find out the best way to maximize the ratio between class scatter and within-class scatter.In LDA methods each and every sample data is classified into one of output classes.But it is difficult in a situation like age classification [7].
Neural networks have been used for the gender classification and there are some other popular mechanisms used for gender classification according to the literature.Former work done on gender classification by using neural network has shown better accuracy than other methods.Details on some of the other mechanisms used in gender classification are, • Support vector machines -Support vector machine is popular as one of the best nonlinear classifier because it produces accurate classification results when compared to other methods.The idea behind the method is to nonlinearly map the input data to some high dimensional space.Disadvantage of the SVM is that it needs a large number of support vectors for the training set to perform classification tasks.• Posterior class probability -Posterior class probability was one of another experimented classification method for gender classification identified [20].After extracting the facial features gender is identified using this method.• Probabilistic Boosting tree -PBT is a learning mechanism among discriminative models which was first proposed by Zhuowen Tu [21].This theory has been practiced for gender classification problem where the data set consists of consumer images and it has achieved better results [13].In this approach, PBT automatically creates a tree.In the learning stage of PBT, every node in the tree combines a number of weak classifiers into a strong classifier.Tree expansion is done using divide and conquer strategy until it approaches the target posterior probability.The root node of the PTB outputs the overall posterior probability by combining the probabilities collected from the sub trees.When constructing a boosting tree, the confidence output by the root node is further mapped to probability by sigmoid function [13].

III. STEP 3: METHODOLOGY
The main goal of the proposed algorithm is to identify corresponding age range and gender from human face images using a specific set of facial features.Facial feature extraction is the most important phase in this algorithm.Fig. 3 shows the flow of this proposed algorithm which consists of three main steps; Pre-processing, Feature Extraction and Classification.

B. Face Area Detection
First phase will proceed to check whether the given input image contains a face part or not.Algorithm will reject the input image if there isn't any face area in the input image.Once the face area is detected, classifier will extract the area and create a separate image per every face in the input image by cropping the background as shown in Fig. 4. The classifier has been trained with a sufficient number of frontal, nearly frontal and rotated faces from 0 to 45 degrees and non face images.Detected face images are preprocessed to standardize the face images by converting them to a unique format.
Then the weight matrix is calculated by setting a value to σ.The output weight matrix for a sample data set by using σ =1.0.colour.Determination process of the presence of a Haar feature is done by subtracting the average dark region pixel value from the average light-region pixel value.A threshold value is provided during the learning process and it checks whether the difference is greater than the threshold value or not.If it is greater than the threshold value, then it indicates that the feature is present.

D. Feature Extraction
Human face contains 66 feature points of landmarks according to the research done in [10] by using images from FG-NET database.
Relevant features important for the classification should be extracted from the face images.According to human gender variation there is a considerable difference in geometric size, shape and distance variations in the facial content.Some of these variations are described in Table 1.Primary feature extraction is the most important phase in the research.Primary features in the human face are eyes, nose, mouth and eyebrow.There exists a specific region where each facial feature falls in an image and therefore, the search space for a facial feature could be minimized.According to this observation, face area can be divide into several pieces and start to locate each feature point using a trained classifier for each feature.
• Locating Primary Features -Once the corresponding primary feature region is found, each feature is located using trained classifiers for each feature.Face regions are first sent to the corresponding classifier to detect the respective feature areas.Then next step is to find the nearest big enough region including the located feature area.Feature point location is detected by applying the integral projection on each feature area.Since eyes have strong intensity variation, the major peak is formed at the position of the eyes in horizontal projection and most probably the lowest valleys in vertical projection represent the eyelid areas.Similarly, the nose can be located by the intensity value difference in the nose trill and the mouth is also located by the same mechanism and "References".Algorithm uses the primary features such as eyes, nose, mouth and eyebrow area according to Fig. 6.(a) and secondly detect secondary features which are extracted from the three areas located on the forehead, cheeks and eyelid area according to Fig. 6. (b).As mentioned in [10], there are 66 feature points on the face area.However, it is better to use only a subset of feature points concerning about the accuracy and complexity.After locating the wrinkle areas use Sobel edge magnitude to identify the measurement of wrinkles in corresponding face images.Wrinkles definitely can be identified from the normal skin because wrinkles have higher Sobel edge magnitudes.
For the age classification, algorithm used wrinkle feature variation from young age to old age.The wrinkle areas are located manually and the Sobel edge magnitude is calculated for each area.Fig. 10.represents the corresponding Sobel edge magnitude image of an input image.

E. Parameter Calculation
A specific set of parameters is required to proceed with age and gender classification.Fig. 11.shows the parameters required to calculate after the feature point extraction.Similarly, the calculated parameter vector for the age classification contains two ratios: ratio between eyes to nose distance and eyes to mouth distance and ratio between distance from eyes to mouth and distance between the two eyes.Two wrinkle parameters from each wrinkle area are also calculated:  Wrinkle Density (W density ) = No of all wrinkle pixels/ No of all pixels in the area  Wrinkle Depth (W depth ) = Total Sobel Magnitude of wrinkle pixels/Total no of pixels in the area.

F. Classification
Classification is done in two main steps.First the gender classifier will identify the corresponding gender of the query image.After that, the image is transferred to the age classifier to identify the corresponding age group.Gender classification is basically done using shape variations of the features on face and the age classification is based on the texture variations in the wrinkle areas.
Classification is done using the calculated parameters from the neural networks.The neural networks are trained using data taken from nearly 1500 images of the two gender groups and different age groups which are images from frontal and nearly frontal faces.Fig. 12. Shows the structure of the neural network used for age classification.Calculated parameters are sent to the corresponding neural network to classify the images according to age and gender.Neural network used for gender classification contains five input nodes and two output nodes 0 and 1 corresponding to the two gender groups, male (0 -0.5) and female (0.5 -1.0).Output value from the neural network is used to classify the image into one of the gender groups.
The neural network used to classify the given input image in to a corresponding age group has eight input nodes and the output layer contains four nodes namely 0, 1, 2 and 3 to represent the age groups 8-13, 14-25, 26-45 and 46-63 respectively.The neuron with the highest response is considered as the output of the age classification neural network.

A. Feature Location based Analysis
• Face Detection -Face detection from a given facial image is done using the Haar wavelet classifier which is introduced in OpenCv library.Image database consists with frontal face images as well as rotated face images.Library handles face detection in 100% accuracy nevertheless it is a frontal image or a rotated image.• Eye Area Identification -Eye detection is done with nearly 90% accuracy by the cascade when the upper half of the face image is provided.After that iris detection is done using vertical projection and horizontal projection for the squared area which combines the two eyes.Nearly 70% accuracy is obtained for the detection of iris using the projection method.Therefore manual identification takes place for the incorrectly detected images.• Nose Area Detection -Nose area identification is done using the cascade classifier provided in the openCV library.Nose detection has achieved 85% accuracy once the middle portion of the face image is given.According to the experiment nose tip can be correctly located with an accuracy of 65% by the horizontal and vertical projection.
Nose tip of rest of the images have to be located manually.• Mouth Area Detection -The detection of the feature points on the mouth has obtained nearly 80% of the accuracy when the bottom part of the face area is given.After locating the mouth bounded by a squared region, we were able to locate the midpoint of the mouth by the results of the vertical and horizontal projection with nearly 75% accuracy for the face images.Mouth feature points are marked manually in the rest of the images.

B. Classification based Analysis
• Parameter Calculation for Classification -Gender classification accuracy highly depends on the calculated results from the facial images for the parameters eye height (P1), distance between eye corner and eye brow corner (P2), height of the nose (P3), Distance between lip and nose (P4) and Width of eye brow (P5).Subset of results taken for the five parameters from the test images are shown in the table 2. Age classification is done using the eight parameters taken from the facial image as discussed in section III.These parameters are calculated for each image in the training image set.Accuracy of the age classification depends on the correctness of calculating these set of parameters.Table 3 shows a sub set of values obtained as parameters to be used in age classification from the test images.4, Table 5 and Table 6 show the results of the proposed methodology.This paper introduced an approach to classify facial images into corresponding gender and age.The main emphasis of this research is to apply the training and learning process of the human brain in pattern recognition and classification from the normal computer.Automatic classification of facial images into age and gender has been used in several applications in the commercial world such as video surveillance systems and enhanced image searching in search engines.The proposed methodology used parameters taken from the geometric facial feature variations influenced by the two gender types and the facial skin texture variation in the ageing process.These parameters are then used to classify the images into corresponding gender and age by using a neural network.Facial images for the research were taken from the two databases namely FERET and FGNET which include the gender and age details along with each image.• Challenges Faced -As a research done for facial images research need a large set of images for accurate results.
Therefore it was very difficult to find facial image database with the corresponding age and gender data.Most of the images are not met the constraints of the methodology.Therefore collecting a large set of images from male and female from the four age categories according to the given lightning conditions, rotation conditions and facial expression was the very challengeable task in the research.After gathering images feature extraction becomes the critical part.All the classification results depend on the correctness of locating the desired feature points.Sometimes the classifiers are not intelligent enough to locate the features correctly.Therefore every image has checked after apply for the feature classifiers to check whether the feature identification is correctly done.If not manual feature locate processed.
• Future Work -Proposed methodology can be improved further to gain higher accuracy in classification.More parameters can be added to represent the geometric variation of gender to the existing classifier in order to increase the performance.Reducing the gap between age ranges would result with a better classification of images in to several age groups.Proposed algorithm can be enhanced to perform accurately under any condition of images in the future.Reducing the gap between the present age ranges would also be a reasonable suggestion to end up with a better classification.
Identification of wrinkles is not 100% accurate as it depends on several external conditions such as facial make-up and smoothing done for the images.Therefore in future it is required to find out another set of parameters which do not cause these problems.In the literature there are lots of solutions suggested using Gabor features with Fuzzy Linear Discriminate Analysis methods and they have concluded with a high accuracy in classification.It will be better to analyse the performance behaviour by using this Fuzzy LDA method combined with the parameters used in the method of age classification.
• Conclusion -The proposed method use facial images in the range of 8 -63 as it is very difficult to recognize the gender of children by the geometric facial feature variations and also there are not enough facial images of people older than 64 to use in the experiment.For the effectiveness of identifying the age of a given facial image, four age groups namely 8 -13, 14 -25, 26 -45 and 45 -63 used where each range has remarkable variations.Totally 1500 images used for the training process including both male and female images within the interested age groups.Face detection and the facial parts such as eyes, nose and mouth area are located using the OpenCV Haar cascade classifiers.After that feature points required for the experiment are extracted using horizontal and vertical projections.There are many difficulties of correctly locating the feature points automatically in some cases when the face area contains birthmarks like patches and also due to different lighting conditions.Parameters in the training data set is input to the neural network to train the system and it is used to classify a given query image into the corresponding gender and age group according to the learning done from the parameters used in the training process.There are two neural networks used for the classification of age and gender.Each of the neural networks performs accurately with one hidden layer comprising with suitable number of neurons.
According to the results taken from the proposed age and gender classification methodology, gender classification from facial images has significantly higher accuracy in classification training data as well as testing data.For the testing data the gender classifier results with a correct classification of 85.83% while the training data set gives 89.92% accuracy when using data from 200 images from each data set.This implies that the classification accuracy for the testing data set is very closer to the classification rate for the training dataset.This can be further interpreted that proposed method for gender classification is a considerably accurate mechanism and it can be used as a successful mechanism in gender classification.According to the results taken from age classifier, accuracy for the training data set is 79.09% and 74.39%.Overall accuracy for the age and gender classifier is 70.5% which is a considerable high accuracy when compared to the overall classification accuracy by human brain which gives a 75% of accuracy.This shows that gender classification by human brain is 100% but when come to age classification it is 67.5%, which shows the difficulty for the classification.Therefore final conclusion of the proposed age and gender classification methodology can be accepted as a successful mechanism.

Fig. 1 .
Fig. 1.Different types of images used in the experiment 1996s according to the literature.Research on facial attribute recognition such as age, gender, ethnicity and facial emotions have been started nearly a decade ago.Thus there are only a few research solutions introduced for facial attribute classification from facial images.It is essential to introduce new approaches with higher accuracies for facial attribute classification from face images.According to the literature, most of the research solutions are based on classifying the images into one of the attributes but not for a combination of attributes.However they have come across three main iterations namely Preprocessing, Feature extraction and Classification.Next sub sections describe the previous work carried out in similar research.

Fig. 3 .
Fig. 3. Main steps of the proposed Age and Gender Classifier

Fig. 4 .
Fig. 4. Detected face area from the Input face image

Fig. 5 .
Fig.5.(a) Input image (b) Detected face area (c) Grayscale image of the face area (d) Smoothed and histogram equalized image Haar wavelets are single wavelength square waves which contain one high interval and one low interval.In two dimensions, a square wave is represented by two adjacent rectangles where the pair contains one light colour and a dark

6 .
Features of interestA classifier is used to identify the eye area from the images as in Fig.7.The classifier has been trained with eye images and non eye images.Horizontal and vertical projections are used to locate feature points.Valley points and peak points of the horizontal and vertical projection can be used to locate the feature points as shown in Fig.8.

Fig. 9 .
Fig. 9. Nose tip location Another classifier has been used to identify the area of the mouth in the images.The classifier has been trained with images with and without mouth areas.It is intelligent enough to locate mouth areas and represent them as a square region and also to locate the end points of the mouth as well.Feature point locating is again done by the horizontal and vertical projections.• Locating Secondary Features -Wrinkles on the face become clearer when people get older.Therefore, wrinkles are the best features to identify the age of an adult person.The general wrinkle areas are; Forehead, Eye Corners and Cheek.After locating the wrinkle areas use Sobel edge magnitude to identify the measurement of wrinkles in corresponding face images.Wrinkles definitely can be identified from the normal skin because wrinkles have higher Sobel edge magnitudes.For the age classification, algorithm used wrinkle feature variation from young age to old age.The wrinkle areas are located manually and the Sobel edge magnitude is calculated for each area.Fig.10.represents the corresponding Sobel edge magnitude image of an input image.

Fig. 10 .
Fig. 10.Sobel edge image of the face area

Fig. 11 .
Fig. 11.Parameters calculated for gender classification The description of the parameters is given below:  Height of Eye = (X1 + X2) / 2  Distance between Eye and Eye brow = (Y1 + Y2) /2  Height of Nose (N) = b -(d + f ) / 2  Distance between Lip and Nose = h -b  Width of Eyebrow = Q  Distance between Eyes (E) = ec  Eye to Upper Lip Distance (L) = h -(f + d) / 2  Ratio1 = Eye Distance /Nose Distance = E / N  Ratio2 = Eye Distance / Eye to Upper Lip Distance = E / L The calculated parameter vector for the gender classification consists of the Eye height (H E), Distance between eye and eye brow (Dist E & EB), Height of the nose (H N), Width of the eye brow (W EB) and Distance between upper lip and nose top (Dist N & L).Similarly, the calculated parameter vector for the age classification contains two ratios: ratio between eyes to nose distance and eyes to mouth distance and ratio between distance from eyes to mouth and distance between the two eyes.Two wrinkle parameters from each wrinkle area are also calculated:  Wrinkle Density (W density ) = No of all wrinkle pixels/ No of all pixels in the area  Wrinkle Depth (W depth ) = Total Sobel Magnitude of wrinkle pixels/Total no of pixels in the area.

Fig. 12 .
Fig. 12. Neural network structure used for Age Classification -Evaluation of the proposed methodology can be summarized using the classification accuracies of each set of data.Accuracy of correctly classified image depending on the age, gender and even the combination of age and gender can be calculated by, Number of correctly classified images is calculated by comparing the results of the algorithm and the stored age and gender values of the corresponding images in the image database.Experiment has used a training data set consisting of nearly 1500 images.Training phase is done by testing the output by changing the number of hidden layer nodes, number of hidden layers and the minimum error value to identify the best classification for the data set provided.A test data set of 200 images is used to measure the performance of the proposed age and gender classification algorithm.Test data set consists of images from both genders and images correspond to the four age groups considered.Table

TABLE 1 FACIAL
CHARACTERISTIC VARIATION BETWEEN MALE AND FEMALE

TABLE 2 VALUES
OBTAIN FOR THE PARAMETERS USED IN GENDER CLASSIFICATION