/Face-and-Emotion-Recognition

Realtime person's face recognize and can classify emotion using webcam, video or images.

Primary LanguagePythonMIT LicenseMIT

Face and Emotion Recognition

This software recognizes person's faces and their corresponding emotions from a video or webcam feed. Powered by OpenCV, Dlib, face_recognition and Deep Learning.

Demo

Image

Dependencies

Usage

  • Download a shape_predictor_68_face_landmarks.dat file from here and put in the folder.
  • test folder contain images or video that we will feed to the model.
  • images folder contain only images of person face to perform face recognition.
  • models contain the pre-trained model for emotion classifier.
  • emotion.py can to run to classify emotions of person's face.
  • face-rec-emotion.py can recognise faces and classify emotion at a time.
  • face_recognition library uses the FaceNet Implementation for face recognition.For more details please visit here

python emotion.py

python face-rec-emotion.py

To train new models for emotion classification

  • Download the fer2013.tar.gz file from here
  • Move the downloaded file to the datasets directory inside this repository.
  • Untar the file: tar -xzf fer2013.tar
  • Download train_emotion_classifier.py from orriaga's repo here
  • Run the train_emotion_classification.py file: python train_emotion_classifier.py

Deep Learning Model

The model used is from this research paper written by Octavio Arriaga, Paul G. Plöger, and Matias Valdenegro.

Model

Credit

  • Computer vision powered by OpenCV.
  • Neural network scaffolding powered by Keras with Tensorflow.
  • FaceNet Research Paper
  • Convolutional Neural Network (CNN) deep learning architecture is from this research paper.
  • Pretrained Keras model and much of the OpenCV code provided by GitHub user oarriaga.