Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

AGE AND GENDER DETECTION USING

OpenCV and
CONVOLUTIONAL NEURAL NETWORK

PROJECT REPORT

MASTER OF COMPUTER APPLICATION


By

KAKARA SURYA VAMSI


18VV1F0003
Under the esteemed guidance of

Dr. Ch. BINDU MADHURI, M Tech, Ph.D.


Assistant Professor
Department of Information Technology
JNTUK-UCEV

Signature of the guide


ABSTRACT
Age and gender, two of the key facial attributes, play a very foundational role in
social interactions, making age and gender estimation from a single face image
an important task in intelligent applications, such as access control, human-
computer interaction, law enforcement, marketing intelligence and visual
surveillance, etc. Automatic age and gender classification has become relevant
to an increasing number of applications, particularly since the rise of social
platforms and social media. Nevertheless, performance of existing methods on
real-world images is still significantly lacking, especially when compared to the
tremendous leaps in performance recently reported for the related task of face
recognition. Age and Gender detection using Convolutional Neural Networks
gives more accuracy compared to the previous one.
TABLE OF CONTENT
Sno Chapter Name Page No
ABSTRACT

1 INTRODUCTION 1
2 METHODOLOGY
2.1 Objective of Age And Gender Detection 2
2.2 About Dataset 2
2.3 Computer vision 3
2.4 OpenCV 4
2.5 Convolutional Neural Network 5
2.6 Layers in CNN 6
2.7 Modules 7-8

3 RESULTS 9-10
4 CONCLUSION 11
CHAPTER-1

INTRODUCTION

Face detection is a method of recognizing if there is a face in an image or not

which is also called as object detection. OpenCV is widely used for object

detection. The goal of face emotion analysis is to detect and identify the

different types of emotions of a person such as happy, sad, anger, confused,

surprise, etc. A gender categorizing model uses face from a given image to

predict the gender (male or female) based on their appearance like baldness,

long hair, beard and mustache . In age classification, we classify based on

wrinkles, hair colour and also size of face etc. Deep learning which is a subset

of machine learning that uses several layers neural network to repeatedly gain

higher level of features from the given input images. The concept of deep

learning was inspired by how neurons function in our brain hence it’s also

called deep neural network. A neural network is a sequence of process that is

capable to identify hidden relationships in a set of data and the process is similar

to the operation of human brain. We use a deep learning model called

convolutional neural network which takes input images and allocate importance

(learnable weights and biases) to different aspects/objects in an image and also

capable of differentiating one from the oth

1|Page
CHAPTER-2

METHODOLOGY

1. OBJECTIVE OF AGE AND GENDER


DETECTION:
Using Deep Learning on the Adience dataset, create a gender and age detector
that can roughly identify the gender and age of the individual (face) in a
photograph.

2. ABOUT DATASET:
We'll utilise the Adience dataset for this Python project; the dataset is available
in the public domain . This dataset serves as a standard for face photographs and
includes noise, lighting, posture, and look, among other real-world imaging
situations. The photos were taken from Flickr albums and are licenced under a
Creative Commons (CC) licence. It's around 1GB in size and contains a total of
26,580 pictures of 2,284 people in eight age groupings (as indicated above).
This dataset was used to train the models .

In this the age is grouped into 8 groups i.e.,(0 – 2), (4 – 6), (8 – 12), (15 – 20),
(25 – 32), (38 – 43), (48 – 53), (60 – 100).

2|Page
3.COMPUTER VISION:
Computer vision is the study of how computers can perceive and recognise
digital pictures and videos in the same way that humans do. The difficulties it
confronts are largely due to a lack of understanding of biological vision.
Computer vision is the process of gathering, processing, analysing, and
comprehending digital images in order to extract high-dimensional data from
the real world and provide symbolic or numeric output.

APPLICATIONS OF COMPUTER VISION:

 Automatic inspection, e.g., in manufacturing applications;


 Assisting humans in identification tasks, e.g., a species
identification system;[23]
 Controlling processes, e.g., an industrial robot;
 Detecting events, e.g., for visual surveillance or people counting, e.g.,
in the restaurant industry;
 Interaction, e.g., as the input to a device for computer-human
interaction;
 Modeling objects or environments, e.g., medical image analysis or
topographical modeling;
 Navigation, e.g., by an autonomous vehicle or mobile robot; and
 Organizing information, e.g., for indexing databases of images and
image sequences.

3|Page
4.OpenCV:
The acronym OpenCV stands for "Open Source Computer Vision." It's an open-
source Computer Vision and Machine Learning library, as the name suggests.
This library can handle real-time image and video processing while also
providing analytical capabilities. It works with the TensorFlow, Caffe, and
PyTorch which are deep learning frameworks.

APPLICATIONS OF OPENCV:

 2D and 3D feature toolkits


 Egomotion estimation
 Facial recognition system
 Gesture recognition
 Human–computer interaction (HCI)
 Mobile robotics
 Motion understanding
 Object detection
 Segmentation and recognition
 Stereopsis stereo vision: depth perception from 2 cameras
 Structure from motion (SFM)
 Motion tracking
 Augmented reality

4|Page
5.CONVOLUTIONAL NEURAL NETWORK:
• A convolutional neural network is a feed-forward neural network that is
generally used to analyze visual images by processing data with grid-like
topology. It’s also known as a ConvNet. A convolutional neural network
is used to detect and classify objects in an image.

• CNNs are used for image classification and recognition because of its


high accuracy. ... The CNN follows a hierarchical model which works on
building a network, like a funnel, and finally gives out a fully-connected
layer where all the neurons are connected to each other and the output is
processed

ARCHITECTURE OF CNN:

5|Page
6. LAYERS IN CNN:
A convolution neural network has multiple hidden layers that help in extracting
information from an image.

The four important layers in CNN are:


1 .Convolution layer
2.ReLU layer
3.Pooling layer
4.Fully connected layer

6|Page
7 .MODULES
In this we use three modules. They are:

1. Face detection using Haar Cascade

2. Gender Recognition using CNN

3. Age Recognition using CNN

MODULES DESCRIPTION:

1. Face detection using Haar Cascade :

Open CV provide direct methods to import Haar-cascades and use them


to detect faces. To apply face detection, which detects the presence and
location of a face in an image, but does not identify it. To extract the 128-
d feature vectors (called “embeddings”) that quantify each face in an
image. Haar cascade XML file which is a classifier used to identify a
specific object from the webcam. The
aarcascasde_frontalface_default.xml provided by OpenCV used to
recognize frontal face. OpenCV connects to the webcam which user can
use to scan their faces for classification of age, gender and emotion.

2. Gender Recognition Using CNN:


7|Page
In the dnn package, OpenCV has provided a class called Net which can
be used to populate a neural network. Furthermore, these packages
support importing neural network models from well known deep learning
frameworks like caffe, tensorflow and torch. CNN models as caffe
models. Therefore, we will be using the CaffeImporter import that model
into our application.

3. Age Recognition with CNN

This is almost similar to the gender detection part except that the
corresponding prototxt file and the caffe model file are
deploy_agenet.prototxt” and “age_net.caffemodel”. Furthermore, the CNN’s
output layer (probability layer) in this CNN consists of 8 values for 8 age
classes (“0–2”, “4–6”, “8–13”, “15–20”, “25–32”, “38–43”, “48–53” and
“60-”)

1 .prototxt — The definition of CNN goes in here. This file defines the
layers in the neural network, each layer’s inputs, outputs and functionality.

2 .caffemodel — This contains the information of the trained neural network


(trained model).

AGE AND GENDER DETECTION

8|Page
CHAPTER-3

RESULTS

AGE AND GENDER DETECTION:


Project Example1:

OUTPUT

9|Page
Project Example2:

OUTPUT:

10 | P a g e
CONCLUSION
Artificial Intelligence systems have grown rapidly over the last years.
This enabled us to create, using multiple models and frameworks, a
system capable of detecting faces and classifying them by age and
gender. The main objective of this research work was to create an
efficient system that was able to detect faces in images and to classify
such faces into age and gender, and to evaluate wrong outputs in order to
find an underlying reason for such failures. In order to fulfill such
objective, various frameworks capable of detecting faces in images and

11 | P a g e
capable of classifying those into age and gender classes were tested and
validated in order to understand which would fit better into our problem.

12 | P a g e

You might also like