0% found this document useful (0 votes)
39 views5 pages

Age and Gender Detection with Python

This document summarizes a technique for age and gender classification using a Python algorithm. The technique uses a convolutional neural network to detect faces from webcam or image input, and classify the gender as male or female and estimated age into one of eight groups. It provides high accuracy on test images compared to actual ages and genders. The algorithm has four main parts - input, face detection, face processing for classification, and output display of results. It provides a simple and efficient method for human classification using only a computer and webcam.

Uploaded by

Vijay Lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views5 pages

Age and Gender Detection with Python

This document summarizes a technique for age and gender classification using a Python algorithm. The technique uses a convolutional neural network to detect faces from webcam or image input, and classify the gender as male or female and estimated age into one of eight groups. It provides high accuracy on test images compared to actual ages and genders. The algorithm has four main parts - input, face detection, face processing for classification, and output display of results. It provides a simple and efficient method for human classification using only a computer and webcam.

Uploaded by

Vijay Lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

International Journal of Interdisciplinary Innovative Research &Development (IJIIRD)

ISSN: 2456-236X
Vol. 05 Issue 01 | 2020

Age and Gender Detection using Python


1Mohd Rafey, 2Gurubasava
1
Masters student, Department of MCA, Jain Deemed to be University, Bengaluru, Karnataka, India.
2
Assistant Professor, School of CS & IT, Dept. of MCA, Jain (Deemed-to-be University)

ABSTRACT
In this paper, the author has worked on a technique for age and gender classification using python
algorithm. Human identification and classification are being utilized in various field for a very long time.
Fields like Government ID Cards, Verification procedures etc. We have already developed techniques like
retina scan, iris scans, fingerprint and other sophisticated systems such as DNA fingerprinting to identify the
individuals. Although these already built methods works efficiently, the hardware, software and human
proficiency requirement are way too demanding for several simpler task which may or may not require a
professional efficiency. Technique reported in this paper is simple and easy for human classification which
can be performed using only a webcam and a decent computer system.
Keywords: Age Estimation, Gender Detection, Python Deep Learning, Convolutional Neural Network,
Webcam
1. INTRODUCTION
Human Classification is an age-old procedure and being done in various fields and technology such as
biometrics, forensics sciences, Image processing, Identification system, etc. With the development of Artificial
Intelligence and techniques such as Neural Network and Deep Learning, it has become increasingly easier to
classify human. These new technologies help identification, classification of Individuals without the need of
another professional or Individual records. Also Being immensely fast, these technologies can classify millions
of individuals way faster than a professional.
Human Facial Image Processing provides many clues and cues applicable to industries such as security,
entertainment, etc [1]. Human Face can provide immense amount of information like their emotional state,
slightest agreement or disagreement, irony or anger, etc. This is the reason why faces have been long research
topic in psychology [2]. This data (or in our case digital data) is very valuable as they help recognition, selection
or identification of individual according to the requirement.
Age and Gender Detection can alone provide a lot of information to places such as recruitment team of
organizations, Verification of ID cards, example: Voter ID cards which millions of individual uses to cast their
vote at the time of election, etc. Human Facial Image processing eases the task of finding ineligible or counterfeit
individuals.
2. RESEARCH METHODOLOGY
Basic requirement for this project includes: Python 2.7-3.6, Open CV2, PyCharm Community Edition,
Webcam (at least 2.0MP). An adequately equipped windows machine to run the project is required.
The Project uses Python Deep Learning to identify the gender and age of given face data accurately.
Deep Learning belongs to the family of machine Learning. Deep Learning mimics the functionality of human
cognitive thinking and acts as an Artificial Intelligence system. It can recognise objects, faces, speeches, characters
from unstructured data sets.
The Algorithm designed is divided into four main parts: Input, Face Detection, Face Processing (Age
and Gender classification) and output.

050134 [Link] 146


International Journal of Interdisciplinary Innovative Research &Development (IJIIRD)
ISSN: 2456-236X
Vol. 05 Issue 01 | 2020

Fig. 1 Flowchart of the Algorithm.

2.1 Input
Main Focus of this design is to make the whole process easier and faster. In order to get the input fast there
are two options to feed the data into the algorithm. First, User can use the system webcam or any other webcam
camera device to directly take the live data. This is not only fast but user can get real-time output while using the
webcam device. Second User can use “—image <name>.jpg” tag while initiating the algorithm. This method reads
the jpeg file, process it and gives back the output. One key advantage of this method is user can process multiple
files at once.
2.2 Face Detection
Face detection has a long research history. Yang et al [3] compared some prominent face detection algorithms
in year 2002, But they did not use any prominent algorithms such as Haar Classifiers in their studies. Haar
Classifier is one of the most prominent and accurate object detection approach described by P. Viola and M. Jones
[4]. For any Face recognition system or facial image processing system to work properly face detection needs to
be implemented properly. A thorough survey can be found in [5] There are several natural (lighting, pose angle,
face marks) as well as digital (noise, glitches) variation imposed while detecting a face in a frame. Difficulties of
human face recognition lie in the following two properties of human face as a pattern: (1) number of patterns, that
is, faces to be classified is tremendous, maybe infinite; and (2) almost all patterns are very similar[5]. We have
used audience dataset of all the different type of variations to fix this issue and increase the efficiency of the
algorithm. The audience set will also act as benchmark for Gender Detection and Age Classification in out neural
network. All the photos have been collected from Creative Common (CC) distribution license.

050134 [Link] 147


International Journal of Interdisciplinary Innovative Research &Development (IJIIRD)
ISSN: 2456-236X
Vol. 05 Issue 01 | 2020
2.3 Face Processing
This process allows us to extract data from the detected face in previous step. Once the face has been detected
data can be extracted. here we are only testing and benchmarking the gender and age of the faces but face can
provide enough information to study emotion, ethnicity, heritage, biasness such as agreement/disagreement,
mood, abnormality. These things are highly useful in various industries. Face is the most natural body part utilized
for biometrics application [5].
Once the face has been detected in the frame. We can start its processing using Convolutional Neural Network
or CNN. It is a type Deep Neural Network which is mostly used for Image processing and NLP. The CNN will
carry out the testing training phase and will give different prediction. For Gender the prediction can be either of
two: Male and Female. Age estimation is a multi-class problem in which the years are classified into classes.
People with different ages have different facials, so it is difficult to gather the information accurately [6]. To make
the process faster we have created age groups. The Age prediction can be either of these 8 groups: (0 – 2), (4 –
6), (8 – 12), (15 – 20), (25 – 32), (38 – 43), (48 – 53) and (60 – 100).
The Architecture here uses three convolutional layers each with different nodes and kernel sizes, specifically:
• 96 nodes with kernel size of 7
• 256 nodes with kernel size of 5
• 384 nodes with kernel size of 3
2.4 Output
It is the last part of the workflow. Here the Output is saved in .jpeg format if the input had image sourced in
it. If the webcam is used the output will be overlaid in the video output from the webcam.
If the face is not detected in input frame the “No Face is detected” will be shown as an output. And no .jpeg output
will be stored.

Fig.2 Output from The Project.

3. PROCEDURE
Since the technique is implemented, we can start testing it for its accuracy. The general procedure to be
followed is
• Input the data.
• Create a frame.
• Detect the face.
• Classify the Gender.
• Classify the Age Group.
• Attach the result in the image.
• Output the image in specified location.
4. TEST RUN
To verify the efficiency of the technique we collected some of human face along with their mentioned
ages when the photo was captured and fed them to the program. The performance can be judged using the chart
below:

050134 [Link] 148


International Journal of Interdisciplinary Innovative Research &Development (IJIIRD)
ISSN: 2456-236X
Vol. 05 Issue 01 | 2020
Input Actual Age and Output Result
Gender
Gender: Male Gender: Male Age Group: (34-48) Both Age and
Age: 38 year Gender are
correct.

Gender: Female Gender: Female Age Group: (22-34) Both Age and
Age: 32 years Gender are
correct.

Gender: Female Gender: Female Age Group: (4-6) Gender is correct


Age: 3 years whereas original
age doesn’t lie in
the predicted agr
group.

Gender: Male Gender: Male Age Group: (22-34) Both Age and
Age: 28 years Gender are
correct.

Gender: Male Gender: Male Age Group: (60-100) Both Age and
Age: 88 years Gender are
correct.

No human face in Gender: Female Age Group: (8-12) Detects a human


this frame face like object as
a legit human
face.

Fig 3. Test run using different sources.


The final result showed promising output with almost perfect result. The only place it faced problem was
when human face like non-human object was provided as an input and since the no data for the non-human object
was stored in training datasets it gave the inaccurate results.
5. KEY FEATURES
Main aim of this technique is to provide faster and cost-effective method of age and gender classification
of human. Key Features of this model are:
• There is no need of high precision hardware or software. It can process the image directly through the camera
device such as webcam. Although a better device will provide more efficient result.
• This technique is easy to use, it does not require a professional level knowledge. A normal computer
knowledge is enough.
• It can process and store hundreds of faces along with the corresponding result without any lag or delay.

050134 [Link] 149


International Journal of Interdisciplinary Innovative Research &Development (IJIIRD)
ISSN: 2456-236X
Vol. 05 Issue 01 | 2020
6. USE CASES
Several uses cases for this project includes the following:
• Identification of the target audience in marketing organisation.
• In Recruitment procedure, to verify legitimacy of the applicants.
• Verification of authentic person applying for government IDs.
• Classification of human resources in bulk.
7. CONCLUSION
“Human Age and gender classification” are two of the many important information gathering resource
from and individual. Human faces provide enough data which may be used for many purposes. In order to reach
the correct audience human age and gender classification is very essential. Here we tried to do the same process
but with general equipment. The efficiency of the algorithm depends on several factor but the main motif of this
project is being easy and faster while also being as accurate as possible.
Work is being done to the improve the efficiency of the algorithm. Some future improvements include
discarding the face like non-human objects, more datasets for people belonging to different ethnic groups and
more granular control over the workflow of the algorithm.
8. REFERENCES

[1] M. H. U. Yap, “Facial image processing for facial analysis,” Proceedings - International Carnahan
Conference on Security Technology., vol. 1, 2010.
[2] C. Y. Jiang X., Applied Pattern Recognition. Studies in Computational Intelligence, Berlin, Heidelberg:
Springer, 2008.
[3] D. J. K. a. N. A. M. H. Yang, “Detecting Faces in Images: A Survey,” IEEE, vol. 24, no. 1, pp. 34-58, 2002.
[4] P. V. a. M. Jones, “Rapid object detection using a boosted cascade of simple features,” Proceedings of the
2001 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, vol. 1, 2001.
[5] W.-Y. &. C. R. &. P. Zhao, “Face Recognition: A Literature Survey,” ACM Comput. Surv.., pp. 399-458.
[6] K. K. Y. Kaya, “A BASIC STUDY ON HUMAN FACE RECOGNITION,” Frontiers of Pattern
Recognition, Academic Press, pp. 265-289, 1972.
[7] D. D. Zhang, “Automated Biometrics - Technologies and Systems,” Kluwer Academic Publishers, vol. 1,
2000.
[8] R. E. a. T. H. E. Eidinger, “Age and Gender Estimation of Unfiltered Faces,” IEEE Transactions on
Information Forensics and Security, vol. 9, no. 12, pp. 2170-2179, 2014.

050134 [Link] 150

Common questions

Powered by AI

Age and gender detection can streamline the recruitment process by verifying the legitimacy of applicants and categorizing human resources more efficiently, thus reducing time and effort spent on manual checks .

Traditional biometric systems like retina, iris scans, fingerprinting, and DNA fingerprinting require high precision hardware, software, and human proficiency, making them demanding for simple tasks. In contrast, the described age and gender detection technique requires only a webcam and a computer, making it more accessible and faster for tasks without professional precision .

The algorithm struggles with non-human objects that resemble human faces because the training datasets used do not include these anomalies, leading to potential misclassification. Improving the dataset to incorporate non-human objects may help in reducing these errors .

CNNs enhance facial image processing by allowing for detailed analysis and processing through multiple convolutional layers with varying nodes and kernel sizes. This structure helps in accurately classifying gender and age by efficiently managing the complexity and variety inherent in facial data .

The age grouping strategy segments ages into eight groups to simplify classification and manage the variability in facial features across different ages. However, this can lead to inaccuracies when individuals fall on the border of age groups. Further refinement might include more granular age categories to improve accuracy, although this would increase the computational complexity .

Automated age and gender detection systems could exacerbate biases if training datasets are not sufficiently diverse, potentially leading to inaccurate classifications for certain ethnicities. Ethically, the deployment of such technologies requires careful consideration of privacy rights and informed consent, particularly in public domains where individuals may not be aware of being scanned .

Future improvements include excluding non-human face-like objects from detection, expanding datasets to include diverse ethnic groups for better accuracy, and refining the algorithm's workflow for more precise results .

The method ensures real-time processing by using a webcam to directly capture live data and process it instantly, allowing users to get real-time outputs. This capability benefits applications such as security and recruitment, where immediate identification and categorization of individuals are crucial .

The technique is accessible due to its requirement for only basic computer knowledge and equipment—namely, a webcam and an adequately equipped computer. It processes images quickly and can handle multiple faces simultaneously, making it practical for general use .

Image processing techniques in age and gender detection relate to psychology by providing insights into emotional states and interpersonal dynamics, and to forensics by aiding in identification tasks. These techniques allow for the rapid analysis of facial cues, which are significant in both psychological assessments and forensic investigations .

You might also like