Skip to content

melvinkokxw/face_emotion_detection

 
 

Repository files navigation

Face Emotion Detection

Table of Contents

About The Project

This projects detect human face emotion with input of image, video or real-time detection. We are using OpenCV to detect and crop the face, and using ResNet101/VGG19 built & trained with PyTorch to predict the face"s emotion

Built With

  • Python3.6
  • OpenCV
  • PyTorch

Getting Started

To get a local copy up and running follow these simple steps.

Installation

  1. Clone the repo
git clone https://github.com/KTAN119/Face_Emotion_Detection
  1. Install required packages
pip install -r requirement.txt

Required files

The following files are required to run the program:

  • Cascade file. The cascade file can be obtained from here or here
  • PyTorch weight file. The weights for a trained emotion classifier is required to predict the faces" emotions. This file is not provided due to the large file size.

Usage

  1. To Detect Image
python emotion_detection.py --input_type "image" --img_file INPUT_IMAGE_FILE_PATH --output_image_directory OUTPUT_IMAGE_DIRECTORY_PATH --weight RESNET101_WEIGHT_PATH --cascade_file CASCADE_FILE_PATH
  1. To Detect Video
python emotion_detection.py --input_type "video" --video_file INPUT_VIDEO_FILE_PATH --output_video_directory OUTPUT_VIDEO_DIRECTORY_PATH --weight RESNET101_WEIGHT_PATH --cascade_file CASCADE_FILE_PATH
  1. Real-time Detection
python emotion_detection.py --input_type "real-time" --weight RESNET101_WEIGHT_PATH --cascade_file CASCADE_FILE_PATH

Credits

Done by Tan Kim Wai and Melvin Kok

Sample image from Jesse Burke Sample video from here

About

Program to detect faces from an image/video/live feed and classify their emotions

Topics

Resources

Stars

Watchers

Forks

Languages

  • Python 100.0%