랭킹으로 돌아가기

atulapra/Emotion-detection

Python

Real-time Facial Emotion Detection using deep learning

emotion-recognitiontflearnhaar-cascadedeep-learningemotion-detectioncomputer-visionopencvopencv-python
스타 성장
스타
1.4k
포크
552
주간 성장
이슈
16
5001k
2017년 8월2020년 7월2023년 7월2026년 7월
아티팩트PyPIpip install emotion-detection
README

Emotion detection using deep learning

Introduction

This project aims to classify the emotion on a person's face into one of seven categories, using deep convolutional neural networks. The model is trained on the FER-2013 dataset which was published on International Conference on Machine Learning (ICML). This dataset consists of 35887 grayscale, 48x48 sized face images with seven emotions - angry, disgusted, fearful, happy, neutral, sad and surprised.

Dependencies

  • Python 3, OpenCV, Tensorflow
  • To install the required packages, run pip install -r requirements.txt.

Basic Usage

The repository is currently compatible with tensorflow-2.0 and makes use of the Keras API using the tensorflow.keras library.

  • First, clone the repository and enter the folder
git clone https://github.com/atulapra/Emotion-detection.git
cd Emotion-detection
  • Download the FER-2013 dataset inside the src folder.

  • If you want to train this model, use:

cd src
python emotions.py --mode train
  • If you want to view the predictions without training again, you can download the pre-trained model from here and then run:
cd src
python emotions.py --mode display
  • The folder structure is of the form:
    src:

    • data (folder)
    • emotions.py (file)
    • haarcascade_frontalface_default.xml (file)
    • model.h5 (file)
  • This implementation by default detects emotions on all faces in the webcam feed. With a simple 4-layer CNN, the test accuracy reached 63.2% in 50 epochs.

Accuracy plot

Data Preparation (optional)

  • The original FER2013 dataset in Kaggle is available as a single csv file. I had converted into a dataset of images in the PNG format for training/testing.

  • In case you are looking to experiment with new datasets, you may have to deal with data in the csv format. I have provided the code I wrote for data preprocessing in the dataset_prepare.py file which can be used for reference.

Algorithm

  • First, the haar cascade method is used to detect faces in each frame of the webcam feed.

  • The region of image containing the face is resized to 48x48 and is passed as input to the CNN.

  • The network outputs a list of softmax scores for the seven classes of emotions.

  • The emotion with maximum score is displayed on the screen.

References

  • "Challenges in Representation Learning: A report on three machine learning contests." I Goodfellow, D Erhan, PL Carrier, A Courville, M Mirza, B Hamner, W Cukierski, Y Tang, DH Lee, Y Zhou, C Ramaiah, F Feng, R Li,
    X Wang, D Athanasakis, J Shawe-Taylor, M Milakov, J Park, R Ionescu, M Popescu, C Grozea, J Bergstra, J Xie, L Romaszko, B Xu, Z Chuang, and Y. Bengio. arXiv 2013.
관련 저장소
serengil/deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python

PythonPyPIMIT Licenseface-recognitionvgg-face
youtube.com/watch
23.1k3.1k
modelscope/FunASR

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

PythonPyPIMIT Licensepytorchspeech-recognition
modelscope.github.io/FunASR/
19.4k1.9k
justadudewhohacks/face-api.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js

TypeScriptnpmMIT Licenseface-recognitionjavascript
17.9k3.9k
Delta-ML/delta

DELTA is a deep learning based natural language and speech processing platform. LF AI & DATA Projects: https://lfaidata.foundation/projects/delta/

PythonPyPIApache License 2.0nlpdeep-learning
delta-didi.readthedocs.io
1.6k283
declare-lab/conv-emotion

This repo contains implementation of different architectures for emotion recognition in conversations.

PythonPyPIMIT Licensedialogue-systemsconversational-agents
1.5k343
MiteshPuthran/Speech-Emotion-Analyzer

The neural network model is capable of detecting five different male/female emotions from audio speeches. (Deep Learning, NLP, Python)

Jupyter NotebookMIT Licenseemotionpython3
1.4k436
otaha178/Emotion-recognition

Real time emotion recognition

PythonPyPIMIT Licensecomputer-visiondeep-learning
1.2k374
maelfabien/Multimodal-Emotion-Recognition

A real time Multimodal Emotion Recognition web app for text, sound and video inputs

Jupyter NotebookApache License 2.0emotion-analysisemotion-recognition
1.1k320
declare-lab/MELD

MELD: A Multimodal Multi-Party Dataset for Emotion Recognition in Conversation

PythonPyPIGNU General Public License v3.0emotion-recognitionsentiment-analysis
1.1k234
sb-ai-lab/EmotiEffLib

Efficient face emotion recognition in photos and videos

Jupyter NotebookApache License 2.0emotion-recognitionface-emotion-detection
1k155