This repository contains machine learning model to recognise human facial expressions. Seven facial expressions can be detected:
- angry
- disgust
- fear
- happy
- sad
- surprise
- neutral
The system captures RGB images from the camera. Input image can be of any size greater than 48x48 pixels. A Haar Cascade is used to detect the faces in the image. Each detected face is cropped and converted to a grayscale image of size 48x48 pixel. The cropped faces are fed into the following neural network structure, which outputs the probability of each facial expression for each detected face.
The TensorFlow saved model signature is as follows:
-
First, clone the repository into your local machine
$ git clone https://github.com/Adaickalavan/emotion-recognition
-
Set the
ROOT
variable in.env
file to point to the root directory of this repository. Set theVIDEO
variable in.env
file to the webcam port number. For example,ROOT = /home/user/go/src/github.com/Adaickalavan/emotion-recognition/ VIDEO = 0
-
Install the necessary python libraries
$ cd /path/to/project/root $ pip install -r requirements.txt
-
Execute the program. Ensure that a webcam is fixed to your computer at the correct port.
$ python "/path/to/emotion-recognition/example/emoRecStream.py"
-
A sample output of the emotion recognition program is shown below.
-
View the Sphinx code documentation by browsing
/doc/_build/html/index.html
in your web browser.