Skip to content

Detecting the emotion of human to distinguish between 5 types of emotion (anger, happy, sad, surprise, unknown)

Notifications You must be signed in to change notification settings

sherwin7/Emotion_Detection

Repository files navigation

Emotion Detection

Detecting the emotion of human with the help of computer vision to distinguish between 5 types of emotion (anger, happy, sad, surprise, unknown). Used an convolutional neural network model (CNN) inspired from VGG-16 model architecture.

The model has been trained on fer2013 dataset and got 60 percent in Google Colabaratory's GPU so it may not be accurate but performs well. you are welcome to train it more.

Built using

Python-3
Tensorflow
Opencv

Setting up in your local machine

We can set this project in your local machine to start predicting.

Step - 1

Open a terminal, clone the Emotion_Detection repository and go into the directory using the command cd.

git clone https://github.com/sherwin7/Emotion_Detection.git

cd Emotion_Detection

Step-2

Check python-3 is installed then install pip manager for python-3 and install virtual environment.

#Checking python is installed
python3 --version 

#Installing pip manager
sudo apt install python3-pip

#Checking pip is installed for python3
pip3 --version

#Installing virtual environment
sudo pip3 install virtualenv

Step-3

Setting up virtual environment.

#Creating virtual environment
virtualenv -p python3 venv

#Activating the virtual environment venv
source venv/bin/activate

Step-4

Now we have to install all the dependencies using pip in our virtual environment from requirements.txt. Check requirements.txt to know what are all the dependencies used.

pip install -r requirements.txt

Step - 5

We can run the emotion_detection.py. Here the video used are in test_videos you can keep yours and try or if you want to use a live video from your webcam In emotion_detection.py change the line 31 (i.e) cap = cv2.VideoCapture('./test_videos/test3.mp4')to cap = cv2.VideoCapture('0') which takes the default camera as input and press q to quit from the program.

python emotion_detection.py

Result

test2.gif

Model Architecture

Image description

About

Detecting the emotion of human to distinguish between 5 types of emotion (anger, happy, sad, surprise, unknown)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages