Department of Computer Science and Engineering Government Polytechnic For Women, Ramanagara 562159
Department of Computer Science and Engineering Government Polytechnic For Women, Ramanagara 562159
Department of Computer Science and Engineering Government Polytechnic For Women, Ramanagara 562159
Submitted By
142CS20018 PUNYA.B.B
142CS20020 RAKSHITHA .K
142CS20022 SAHANA.K
Lecture
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
RAMANAGARA 562159
2022-23
CERTIFICATE
External viva
1.
2.
4
DECLARATION
DATE:
PUNYA B B
RAFIYA NISBA
RAKSHITHA K
SAHANA K
ACKNOWLEDGEMENT
The completion of any project Involves the efforts of many people. We have been
lucky to have received a lot of helps and support from all directions during the
making of this project, so with gratitude we take this opportunity to acknowledge
all those whose guidance & encouragement helped us to emerge successful.
We would like to express our profound sense of gratitude to our guide MISS
SUJATHA RATNAKAR , Department of CS&E for his kind guidance.
Project Associates:
PUNYA B B
RAFIYA NISBA
RAKSHITHA K
SAHANA K
CONTENTS:
Acknowledgement
Table of Contents
Abstract
1.INTRODUCTION
1.1 ABOUT GENDER & AGE DETECTION PROJECT
1.2 APPLICATIONS
2.REQUIREMENTS SPECIFICATION
2.1 USER REQUIREMENTS
2.2 FUNCTIONAL REQUIREMENTS
2.3 HARDWARE SPECIFICATION DETAILS
2.4 SOFTWARE SPECIFICATION DETAILS
3.DESIGN
4.IMPLEMENTATION
4.1code
Abstract
Automatic prediction of age and
gender from face images has
drawn a lot of attention
recently,
due it is wide applications in
various facial analysis
problems. However, due to the
large intra-
class variation of face images
(such as variation in lighting,
pose, scale, occlusion), the
existing
models are still behind the
desired accuracy level, which is
necessary for th
Age and Gender
Detection System
Abstract
Automatic prediction of age and
gender from face images has
drawn a lot of attention
recently,
due it is wide applications in
various facial analysis
problems. However, due to the
large intra-
class variation of face images
(such as variation in lighting,
pose, scale, occlusion), the
existing
models are still behind the
desired accuracy level, which is
necessary for the use of these
models in real-world
applications. In this work, we
propose a deep learning
framework, based
on the ensemble of attentional
and residual convolutional
networks, to predict gender and
age
group of facial images with
high accuracy rate. Using
attention mechanism enables
our model to
focus on the important and
informative parts of the face,
which can help it to make a
more
accurate prediction. We train
our model in a multi-task
learning fashion, and augment
the
feature embedding of the age
classifier, with the predicted
gender, and show that doing so
can
further increase the accuracy of
age prediction. Our model is
trained on a popular face age
and
gender dataset, and achieved
promising results. Through
visualization of the attention
maps of
the train model, we show that
our model has learned to
become sensitive to the right
regions of
the fac
Automatic prediction of age and gender from face images has drawn a lot of
attention recently,
due it is wide applications in various facial analysis problems. However, due to the
large intra-class variation of face images(such as variation in lighting, pose, scale,
occlusion), the existing models are still behind the desired accuracy level, which is
necessary for the use of these models in real-world applications. In this work, we
propose a deep learning framework , based on the ensemble of attentional and
residual convolutional networks, to predict gender and age group of facial images
with high accuracy rate. Using attention mechanism enables our model to focus
on the important and informative parts of the face, which can help it to make a
more accurate prediction. We train our model in a multi-task learning fashion,
and augment the feature embedding of the age classifier, with the predicted
gender, and show that doing so can further increase the accuracy of age
prediction. Our model is trained on a popular face age and gender dataset, and
achived promising results. Through visualization of the attention maps of the train
model, we show that our model has learned to become sensitive to the right
regions of the face.
INTRODUCTION
Due to the rise of social platforms and social media nowadays, there is also an increase in the
number of applications that want automatic age and gender classification. As we know, age and
Gender are two key facial attributes that play a very important role in social interactions.
So, in this deep learning project. we will be creating real-time gender and age detection using
Deep Learning, and also in this, we will be using pre-trained models that classify the gender and
age of the person. So the model will predict the gender as ‘Male’ and ‘Female’, and the
predicted age will be in one of the following ranges- (0-2),(4-6),(8-12),(15-20),(25-32),(38-43),
(48-53),(60-100) ( so there are 8 nodes in the final output layer or say softmax layer).
It is very difficult to predict the exact age of the person due to many reasons like (makeup, light,
facial expressions, etc.) so that’s why we have considered this as a classification problem
instead of a regression problem.
To identify the age and gender of several faces’ procedures, are followedby several
methods. From the neural network, features are taken by the convolution network. In
light of the prepared models, the image is processed into one of the age classes. The
highlights are handled further and shipped off the preparation frameworks.
Artificial intelligence-based face analyzed technologies have gained serious importance. The
most important factor underlying the popularity of these technologies is that they can be used
very effectively in business life. Thanks to these technologies, such as customer segmentation,
product development, and business diary have all become improvable. The most widely used
artificial intelligence technologies based on face analysis are age detection and face
gender detection technologies. These technologies provide highly effective
APPLICATIONS
In the forensic field, where often only the description of suspect is available,
usually the data that is always gender and an age range, which would be very
useful in reducing the list of candidates to be compared with the sketch to get
answers to be more precise.
TECHNOLOGIES USED
1.OpenCv
openCV is Open Source Computer vision. This libray is capable of processing real-
time frame and viedo while also boasting analytical capabilities.
CNN is deep neural network widely used for the purpose of frame recognition
and processing and NLP.
3.TENSORFLOW
Tensor Flow is an end-to end open source platform for machine learning.
TensorFlow is a rich system for managing all aspects of a machine learning system
Abstract
Automatic prediction of age and
gender from face images has
drawn a lot of attention
recently,
due it is wide applications in
various facial analysis
problems. However, due to the
large intra-
class variation of face images
(such as variation in lighting,
pose, scale, occlusion), the
existing
models are still behind the
desired accuracy level, which is
necessary for th
Age and Gender
Detection System
Abstract
Automatic prediction of age and
gender from face images has
drawn a lot of attention
recently,
due it is wide applications in
various facial analysis
problems. However, due to the
large intra-
class variation of face images
(such as variation in lighting,
pose, scale, occlusion), the
existing
models are still behind the
desired accuracy level, which is
necessary for the use of these
models in real-world
applications. In this work, we
propose a deep learning
framework, based
on the ensemble of attentional
and residual convolutional
networks, to predict gender and
age
group of facial images with
high accuracy rate. Using
attention mechanism enables
our model to
focus on the important and
informative parts of the face,
which can help it to make a
more
accurate prediction. We train
our model in a multi-task
learning fashion, and augment
the
feature embedding of the age
classifier, with the predicted
gender, and show that doing so
can
further increase the accuracy of
age prediction. Our model is
trained on a popular face age
and
gender dataset, and achieved
promising results. Through
visualization of the attention
maps of
the train model, we show that
our model has learned to
become sensitive to the right
regions of
the fac
Age and Gender
Detection System
Abstract
Automatic prediction of age and
gender from face images has
drawn a lot of attention
recently,
due it is wide applications in
various facial analysis
problems. However, due to the
large intra-
class variation of face images
(such as variation in lighting,
pose, scale, occlusion), the
existing
models are still behind the
desired accuracy level, which is
necessary for the use of these
models in real-world
applications. In this work, we
propose a deep learning
framework, based
on the ensemble of attentional
and residual convolutional
networks, to predict gender and
age
group of facial images with
high accuracy rate. Using
attention mechanism enables
our model to
focus on the important and
informative parts of the face,
which can help it to make a
more
accurate prediction. We train
our model in a multi-task
learning fashion, and augment
the
feature embedding of the age
classifier, with the predicted
gender, and show that doing so
can
further increase the accuracy of
age prediction. Our model is
trained on a popular face age
and
gender dataset, and achieved
promising results. Through
visualization of the attention
maps of
the train model, we show that
our model has learned to
become sensitive to the right
regions of
the fac
REQUIREMENTS SPECIFICATION
System requirements are expressed in software requirement document.It is the official
statement of what is required of the system developers.Requirements document includes the
requirement definitions and requirement specification . The software requirement document is
not a designed document. It should set out what the system should do without specifying how
it should be done.
USER REQUIREMENT:
FUNCTIONAL REQUIRMENTS
Predict their Age ( Classify them into 8 age ranges that is mentioned above)
And at last put the results on the person’s face and display it.
HARDWARE REQUIREMENT
Processor :Intel 386 onwards Compatible Hardware
RAM:4GB RAM
Web camera
Computer
SOFTWARE REQUIRMENT
Operating system:windows 10
Libraries:cv2
DESIGN
So the Source Code folder for gender and age detection project consists of the following files:
age_deploy.prototxt: This is the file that will be required to run the age classification model.
age_net.caffemodle: This is the model file that contains the trained model which classifies the age in the
specified range.
gender_deploy.prototxt: This is the file which will be required to run the gender classification model.
gender_net.caffemodel: This file contains the trained model which predicts the gender of a person
present in an image or frame.
opencv_face_detector_unit8.pb : With the help of this file we will be able to detect faces.
Real_time_gender_age_detection.py: This is our main python file which contains whole code in which
we have used all the models and classify persons gender and age in real-time.
The full form of OpenCV is Open Source Computer Vision. It is widely used in machine learning as it is
capable of processing real-time image and video.
1. Download this zip. Unzip it and put its contents in a directory you’ll call gad.
opencv_face_detector.pbtxt
opencv_face_detector_uint8.pb
age_deploy.prototxt
age_net.caffemodel
gender_deploy.prototxt
gender_net.caffemodel
2. We use the argparse library to create an argument parser so we can get the image
argument from the command prompt. We make it parse the argument holding the path
to the image to classify gender and age for.
For face, age, and gender, initialize protocol buffer and model.
Initialize the mean values for the model and the lists of age ranges and genders to
classify from.
Now, use the readNet() method to load the networks. The first parameter holds trained
weights and the second carries network configuration.
Let’s capture video stream in case you’d like to classify on a webcam’s stream. Set
padding to 20.
Now until any key is pressed, we read the stream and store the content into the names
hasFrame and frame. If it isn’t a video, it must wait, and so we call up waitKey() from cv2,
then break.
Let’s make a call to the highlightFace() function with the faceNet and frame parameters,
and what this returns, we will store in the names resultImg and faceBoxes. And if we got
0 faceBoxes, it means there was no face to detect. Here, net is faceNet- this model is the
DNN Face Detector and holds only about 2.7MB on disk.
Create a shallow copy of frame and get its height and width.
faceBoxes is an empty list now. for each value in 0 to 127, define the confidence
(between 0 and 1). Wherever we find the confidence greater than the confidence
threshold, which is 0.7, we get the x1, y1, x2, and y2 coordinates and append a list of
those to faceBoxes.
Then, we put up rectangles on the image for each such list of coordinates and return
two things: the shallow copy and the list of faceBoxes.
But if there are indeed faceBoxes, for each of those, we define the face, create a 4-
dimensional blob from the image. In doing this, we scale it, resize it, and pass in the
mean values.
We feed the input and give the network a forward pass to get the confidence of the two
class. Whichever is higher, that is the gender of the person in the picture.
We’ll add the gender and age texts to the resulting image and display it with imshow().
IMPLEMENTATION
Source code
Input code:
import cv2
faceProto = "opencv_face_detector.pbtxt"
faceModel = "opencv_face_detector_uint8.pb"
ageProto = "age_deploy.prototxt"
ageModel = "age_net.caffemodel"
genderProto = "gender_deploy.prototxt"
genderModel = "gender_net.caffemodel"
video = cv2.VideoCapture(0)
padding = 20
while True:
hasFrame, vidFrame = video.read()
if not hasFrame:
cv2.waitKey()
break
if not faceBoxes:
print("No face detected")
genderNet.setInput(blob)
genderPred = genderNet.forward()
gender = genderList[genderPred[0].argmax()]
ageNet.setInput(blob)
agePred = ageNet.forward()
age = ageList[agePred[0].argmax()]
video.release()
cv2.destroyAllWindows()
output
CONCLUSION