Mini Project
Mini Project
Mini Project
A Project report submitted in partial fulfilment of the requirements for the award of Degree of
BACHELOR OF TECHNOLOGY
In
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted by
CERTIFICATE
This is to certify that the Minor Project work entitled
“FACE EMOTION RECOGNITION USING PYTHON” is a bonified work done
by S. Hemalatha (19A51A04B6) , T. Sushmitha (19A51A04B9), A.
Charan kumar (19A51A0466) , B. Raj kumar (19A51A0474) and submitted in
partial fulfilment of the requirement for the award of the degree of BACHELOR OF
TECHNOLOGY in ELECTRONICS AND COMMUNICATION
ENGINEERING.
S. Hemalatha
T. Sushmitha
A. Charan kumar
B. Rajkumar
DEPARTMENT OF ECE
Vision of the Department:
Create high quality engineering professionals through research, innovation and team work for
a lasting technology development in the area of electronics and communication engineering.
2. Problem analysis: Identify, formulate, review research literature, and analyse complex
engineering problems reaching sustained conclusions using first principals of
mathematics, natural sciences and engineering sciences.
5. Modern tool usage: Create, select and apply appropriate techniques, resources, and
modern engineering and it tools including prediction and modelling to complex engineering
activities with an understanding of the limitations
6. The engineer and society: Apply reasoning informal by the contextual knowledge to
access societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
12. Lifelong learning: Recognize the need for, and have the preparation and ability to
engage in independent and lifelong learning in the broadest context of technological
change.
1. ABSTRACT------------------------------------------------------------------------------9
2. CHAPTER-1------------------------------------------------------------------------------10
1. INTRODUTION
1,1 FACIAL EXPRESSIONS
1.2 IMAGE
1.3 IMAGE PROCESSING
1.4 PIXEL
1.5 TYPES OF IMAGES
1.5,1 BINARY IMAGE
1.5.2 BLACK AND WHITE IMAGE
1.5.3 GRAYSCALE IMAGE
1.5.4 COLOR IMAGE
3. CHAPTER-2------------------------------------------------------------------------------16
2.2 MOTIVATION
4. CHAPTER-3--------------------------------------------------------------------------------23
5. CHAPTER-4-------------------------------------------------------------------------------27
6. CHAPTER -5-------------------------------------------------------------------------------30
5.IMPLEMENTATION
5.1 BLOCK DIAGRAM
5.2 PROJECT DISGING / CODE
5.3 WORKING
5.4 RESULTS
7. CHAPTER -6 --------------------------------------------------------------------------------34
6.1 APPLICATIONS
6.1.1 FACIAL EMOTION DETECTION IN INTERVIEWS
6.1.2 TESTING FOR VIDEO GAMES
6.1.3 MARKET RESEARCH
6.2 ADVANTAGES
6.3 DISADVANTAGES
6.4 CONCLUSION
6.5 FUTURESCOPE
8. CHAPTER-7-----------------------------------------------------------------------------------38
7.1 REFERENCES
7.2 WEB REFERENCES
ABSTRACT
One of the ways humans communicate is by using facial expressions. Research on technology
development in artificial intelligence uses deep-learning methods in human and computer
interactions as an effective system application process. One example, if someone does show
and tries to recognize facial expressions when communicating. The prediction of the expression
or emotion of some people who see it sometimes does not understand. In psychology, the
detection of the face emotions or facial expressions requires analysis and assessment of
decision in prediction a person’s emotions or a group of people communicating. This research
proposes the design of a system that can predict and recognize the classification of facial
emotions based Network (CNN) method using Facial Emotion Recognition (FER-2013) were
on feature extraction using the Convolutional Neural Network (CNN) algorithm in real-time
with the Open CV library, namely : Tensor Flow and Keras. The research design implemented
in the Raspberry Pi consists of three main processes namely : Facial Detection, Facial Feature
Extraction and Facial Emotion Classification.
Chapter-1
INTRODUCTION
1. INTRODUCTION:
Now-a-days, Emotion recognition is a significant area in computer vision. It is computerized
software that helps to identify human feelings such as Happiness, Anger, Sadness, Fear,
Disgust, and Surprise. Moreover, emotion Recognition has its foothold on public places.
Examples of human emotions on public place like severe argument between two persons,
driving vehicle with anger and so on. By understanding emotion of the person, able to prevent
any gruesome act or danger. Human emotion recognition plays an important role in the
interpersonal relationship. Emotions are reflected from speech, hand and gestures of the body
and through facial expressions. Hence extracting and understanding of emotion has a high
importance of the interaction between human and machine communication person's mood can
be easily identified by their emotions rather than their words.
Face emotion recognition is a process of detecting human emotions from facial expressions
and this project main theme is the human brain recognizes emotions automatically and then the
software has been developed that can recognize emotions as well.
1.2 IMAGE:
An image is an artifact that depicts visual perception, such as photograph or other two-
dimensional picture, that resembles a subject usually a physical object and thus provides
a depection of it. In the context of signal processing, an image is a distributed amplitude of
colour (s). A pictorial script is a writing system that employs images as symbols for various
semantic entities, rather than the abstract signs used by alphabets. Image speaks louder than
words. An image, be it a digital or a still image, all of it is nothing but a binary representation
of some visual information. The visual information can be a simple drawing, photographed
pictures, and recorded graphs, logos or anything of this sort. All of these digital images have
something in common. They all can be stored and saved for future use electronically in any
storage device. Listeners are presented with a sample image with information inside it. This is
a digital image stored in any digital storage medium.
1.3 IMAGE PROCESSING :
Image processing is a method to perform some operations on an image, in order to get an
enhanced image or to extract some useful information from it. It is a type of signal processing
in which input is an image and output may be image or characteristics/features associated with
that image. Nowadays, image processing is among rapidly growing technologies. It forms core
research area within engineering and computer science disciplines too. Images define the
world, each image has its own story, it contains a lot of crucial information that can be useful
in many ways. This information can be obtained with the help of the technique known as image
processing. It is the core part of computer vision which plays a crucial role in many real-world
examples like robotics, self-driving cars, and object detection. Image processing allows us to
transform and manipulate thousands of images at a time and extract useful insights from them.
It has a wide range of applications in almost every field. Python is one of the widely used
programming languages for this purpose. Its amazing libraries and tools help in achieving the
task of image processing very efficiently. Through this article, you will learn about classical
algorithms, techniques, and tools to process the image and get the desired output. In digital
image processing, the same image shall be fed in as input to the system and the system shall
interpret and understand the content to let the future actions happen. The algorithms developed
shall play a major role in understanding the content with higher accuracy.
1.4 PIXEL:
One should understand that, an image is nothing but, an array or a matrix of a multiple pixels
which are properly arranged in columns and rows. Now, it is good to understand that what a
pixel is. A pixel is a word framed from picture element. A pixel is the smallest unit in a digital
image. Multiple pixels arranged in rows and columns actually form an image. An image is fully
composed of pixels.
The binary image is all about 0’s and 1’s. A binary will contain only two colours. One being
white and other being black. Always the ‘black’ is represented by ‘0’ and ‘white’ is represented
by ‘1’. Each pixel in this type of image will have either of the two- 0 or 1, representing black
or white respectively. The same presented in the figure. In the binary image, each pixel needs
only the one-bit storage space. Be it white or black, what we need is just a bit to store that pixel.
This is important aspect to be remembered and this shall help in distinguish the binary image
from the black and the white image.
Most of the beginners shall have confusion with understanding what a binary image is and what
a black and white image is. There is a fundamental difference that differentiates these two.
When it comes to black and white image, each pixel would need 8-bit storage space. Either if
these pixels could have 0 or 1. Again, 0 represents the black and 1 represents white. Multiple
0s and 1s shall be there in an image, but the storage image requirement for the pixels is much
higher. This gives smoothness and enriched quality for the image.
An image is an artifact that depicts visual perception, such as photograph or other two-
dimensional picture, that resembles a subject usually a physical object and thus provides
a depection of it. In the context of signal processing, an image is a distributed amplitude of
color(s). A pictorial script is a writing system that employs images as symbols for various
semantic entities, rather than the abstract signs used by alphabets. Image speaks louder than
words. An image, be it a digital or a still image, all of it is nothing but a binary representation
of some visual information. The visual information can be a simple drawing, photographed
pictures, and recorded graphs, logos or anything of this sort. All of these digital images have
something in common. They all can be stored and saved for future use electronically in any
storage device. Listeners are presented with a sample image with information inside it. This is
a digital image stored in any digital storage medium.
Chapter-2
LITERATURE SURVEY
&
MOTIVATION
2.1 LITERATURE SURVEY:
Face detection technology is used in many fields: entertainment, security, law
enforcement, biometrics, and more. Over the years, it has progressed from clunky
computer vision techniques all the way to advanced artificial neural networks. Face
detection has a key role in face analysis, tracking, and recognition – but the question
is, what exactly is face detection and how does it work? Read on, and we’ll break down
the term for you, provide examples, and show how it is used in today’s society.
Face detection technology uses machine learning and algorithms in order to extract human
faces from larger images; such images typically contain plenty of non-face objects, such as
buildings, landscapes, and various body parts. Facial detection algorithms usually begin by
seeking out human eyes, which are one of the easiest facial features to detect. Next, the
algorithm might try to find the mouth, nose, eyebrows, and iris. After identifying these facial
features, and the algorithm concludes that it has extracted a face, it then goes through
additional tests to confirm that it is, indeed, a face.To make algorithms as accurate as
possible, they must be trained with huge data sets that contain hundreds of thousands of
images. Some of these images contain faces, while others do not. The training procedures
help the algorithm’s ability to decide whether an image contains faces, and where those facial
regions are located.Also, now would be a good time to give you definitions of the main types
of algorithms – ML, AI, and Deep Learning.
OpenCV;
Matlab;
Tensorflow;
Neural Networks.
All of these follow almost the exact same procedure for face detection.
Three researchers from the University of California, David Kriegman, Ming-Hsuan Yang,
and Narendra Ahuja, published a classification of facial detection methods. There are four
classifiable categories, of which face detection algorithms can belong to 2+ groups. Let’s take
a look at each category.
Feature-Based Method:
This method located faces by extracting structural features. First, an algorithm is trained as a
classifier. Next, it is used to sort facial regions from non-facial regions. The general idea is to
move past humans’ instinctive knowledge of faces. When feature-based approaches tackle
photos with many faces, they have a 94% success rate.
Summary: Features such as a person’s nose or eyes are used to detect a face.
Knowledge-Based Method:
Summary: A face is determined based on whether it meets a set of rules made by a human.
With a template matching algorithm, parameterized or pre-defined templates are used to locate
or detect faces – the system measures the correlation between the input photos and the
templates. For instance, the template may show that a human face is divided into nose, mouth,
eyes, and face contour regions. Also, a facial model could be comprised of just edges and use
the edge detection method – implementation of this approach is easy, but it is insufficient for
face detection.
Summary: Images are compared to standard face patterns that have been previously stored.
Appearance-Based Method:
An appearance-based algorithm uses a set of training images to “learn” what a face should look
like. In general, this method relies on machine learning and statistical analysis to determine
relevant facial characteristics. An appearance-based approach is generally considered to be
stronger than the previously mentioned methods.
Summary: Statistical analysis and machine learning are combined to find a face image’s
characteristics.
2. With color images, the color of the skin can sometimes be used to find faces;
When the aforementioned strategies are combined, they can create a comprehensive face
detection approach.
Odd expressions. A human face might have an odd expression, making it difficult for
facial detection algorithms to identify it as a face;
Face occlusion. If a face is hidden by hair, a hat, a hand, glasses, or a scarf, it may result
in a false negative;
Illuminations. An image might not have uniform lighting effects; part of the image
may be overexposed, while another part is very dark. Again, this can contribute to
false negatives;
Complex background. When lots of objects are present in an image, face detection’s
accuracy is reduced;
Too many faces. If there is a large number of human faces in an image, face detection
software may have a hard time distinguishing between some of them;
Low resolution. If an image’s resolution is poor, it is more difficult to detect faces;
Skin color. If somebody’s skin color falls outside of the gradient that is recognized by
the algorithm,their face might not be detected.
Facial recognition is merely one application of face detection. The for mer is used for
biometric verification and device unlocking, whereas the latter can also be applied to facial
analysis and tracking.
Classification of emotions:
Trying to interpret a person’s emotional state in a non verbal form, usually requires decoding
his or hers facial expression. Many times, body language especially facial expressions, tell us
more than a words about one’s state of mind. For this project we have performed an experiment
which serves multiple purposes. A facial expression is a gesture executed with the facial
muscles, which convey the emotional state of the subject to observers. Am expression sends a
message about a person’s internal feeling. In Hebrew, The word for ‘face’-has the same letters
as the word represents ‘within’ or ‘inside’, that similarity implies about the facial expression
most important role being a channel of non-verbal communication. Facial expressions are
primary means of conveying non-verbal information among humans, though many animal
species display facial expressions too. Although human developed a very wide range and
powerful of verbal languages, facial expression role in interactions remains essential, and
sometimes even critical.
Chapter-3
METHODOLOGY
3.1 Convolutional Neural Network (CNN):
A convolutional neural network (CNN) is a type of artificial neural network used in image
recognition and processing that is specifically designed to process pixel data. CNNs are
powerful image processing, artificial intelligence (AI) that use deep learning to perform both
generative and descriptive tasks, often using machine vision that includes image and video
recognition, along a recommender system. A neural network is a hardware or/ a software
patterned after the operations of neurons in the human brain. The convolutional neural network
is a class of a deep neural network. They have an application in image classification, image
segmentation, medical image analysis, natural language processing, brain-computer interfaces
and financial time series. CNN is a regularized version of multilayer perception. Multilayer
perception usually mean fully connected networks that is each neuron in one layer is connected
to all neurons in the next layer.
FIGURE-2:
Fig.3.4 a .Vertical and horizontal edge detector filter matrix used at layer 1 of background-
removal CNN (first-part of CNN).
b. Sample EV matrix showing all the 24 values in the panel in top and parameter measured
at bottom.
c. Representation of point in Image domain (top panel) to Hough transform domain (bottom
panel) using Hough transform.
Python interpreters are available for many operating systems. A global community of
programmers develops and maintains C Python, an open source reference implementation. A
non-profit organization, the Python Software Foundation, manages and directs resources for
Python and C Python development.
4.3 FER library: The FER-2013 dataset was created by gathering the results of a
Google image search of each emotion and synonymsoftheemotions. The CK+ dataset has a
total of 5,876 labeled images of 123 individuals. ... Each image is labeled with one of seven
emotions: happy, sad, angry, afraid, surprise, disgust, and contempt.
Fer2013 contains approximately 30,000 facial RGB images of different expressions with size
restricted to 48×48, and the main labels of it can be divided into 7 types: 0=Angry, 1=Disgust,
2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral. The Disgust expression has the minimal
number of images – 600, while other labels have nearly 5,000 samples each.
The commonly used dataset for this image classification is FER2013 / Face Expression
Recognition which prepared by Pierre-Luc Carrier and Aaron Courville, as part of an ongoing
research project (Kaggle said).
Happiness
Sadness
Fear
Anger
Surprise
Disgust
Fig.4.1 emotions demo image
Chapter-5
IMPLEMENTATION
5.1 BLOCK DIAGRAM:
Fig.5.1 Illustration of the FER system based on transfer learning in deep CNN.
Illustrates the proposed FER system with VGG-16, the well-known pre-trained DCNN model.
The available VGG-16 model is trained with the ImageNet dataset to classify 1000 image
objects. The pre-trained model is modified for emotion recognition redefining the dense layers,
and then fine-tuning is performed with emotion data. In defining the architecture, the last dense
layers of the pre-trained model are replaced with the new dense layer(s) to recognize a facial
image into one of seven emotion classes (i.e., afraid, angry, disgusted, sad, happy, surprised,
and neutral). A dense layer is a regular, fully connected, linear layer of a NN that takes some
dimension as input and outputs a vector of the desired dimension. Therefore, the output layer
contains only seven neurons. The fine-tuning is performed on the architecture having the
convolution base of the pre-trained model plus the added dense layer(s). A cleaned emotion
dataset prepared through preprocessing (i.e., resizing, cropping, and other tasks) is used to train
in fine-tuning. In the case of testing, a cropped image is placed to the input of the system, and
the highest output probability of emotion is considered to be the decision. VGG-16 may be
replaced with any other DCNN models, e.g., ResNet, DenseNet, Inception. Therefore, the size
of the proposed model depends on the size of the pre-trained model used and the architecture
of the added dense layer(s).
5.2 PROJECT DESIGNING/CODE:5.3 Working :
Coverts image into an array of pixel values . where the dimentions of array depends on the
resolutions of image
Array automatically generated by computer from input image
5.4 Results:
Emotion : happy
EMOTION: sad
EMOTION: netural
Chapter:6
CONCLUSTION
6.1 Applications:
Face detection technology is used in many fields: entertainment, security, law enforcement,
biometrics, and more. Over the years, it has progressed from clunky computer vision
techniques all the way to advanced artificial neural networks. Face detection has a key role in
face analysis, tracking, and recognition – but the question is, what exactly is face detection and
how does it work? Read on, and we’ll break down the term for you, provide examples, and
show how it is used in today’s society.
6.2 ADVANTAGES:
As a key element in facial imaging applications such as facial recognition, facial analysis and
face detection creates various advantages for users, including:
Improved security: Face detection improves surveillance efforts and helps track down
criminals and terrorists. Personal security is also enhanced since there is nothing for hackers to
steal or change, such as passwords.
Easy to integrate: Face detection and facial recognition technology is easy to integrate and
most solutions are compatible with the majority of the security software.
Automated identification: In the past, identification was manually performed by a person;
this was inefficient and frequently inaccurate. Face detection allows the identification process
to be automated, thus saving time and increasing accuracy.
6.3 DISADVANTAGES:
While face detection provides several large benefits to users, it also holds various
disadvantages, including:
Massive data storage burden: The ML technology used in face detection requires powerful
data storage that may not be available to all users.
Detection is vulnerable: While face detection provides more accurate results than manual
identification processes, it can also be more easily thrown off by changes in appearance or
camera angles.
A potential breach of privacy: Face detection's ability to help the government track down
criminals creates huge benefits; however, the same surveillance can allow the government to
observe private citizens. Strict regulations must be set to ensure the technology is used fairly
and in compliance with human privacy rights.
6.4 CONCLUSION:
Facial expressions can display personal emotions and indicate an individual's intentions within
a social situation. They are extremely important to the social interaction of individuals.
Background scenes in which faces are perceived provide important contextual information for
facial expression processing. Facial expression recognition in the real-world case is a long-
standing problem. The low image quality, partial occlusions, and illumination variation in the
real-word environment make the feature extraction process more challenging. In this paper, we
exploit both texture and geometric features for effective facial expression recognition.