Skip to content

This project implements a real-time emotion recognition system using computer vision and deep learning techniques. It leverages OpenCV for video capture and face detection, along with the DeepFace library for emotion analysis. The system identifies and classifies emotions expressed by individuals captured through a webcam.

Notifications You must be signed in to change notification settings

PK-SANGAMESWAR/Facial_Emotion_Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Facial_Emotion_Recognition

This project implements a real-time emotion recognition system using computer vision and deep learning techniques. It leverages OpenCV for video capture and face detection, along with the DeepFace library for emotion analysis. The system identifies and classifies emotions expressed by individuals captured through a webcam.This project focuses on real-time facial emotion detection utilizing the DeepFace library in conjunction with OpenCV. It captures live video from the webcam, identifies faces, and predicts the emotions displayed on each face. The detected emotions are overlaid on the video frames in real time, creating an interactive experience for monitoring emotional expressions. This implementation stands out as a streamlined solution for emotion recognition in real-time scenarios, showcasing my skills in computer vision and deep learning.

Created by PK SANGAMESWAR

Dependencies

DeepFace: A powerful deep learning library designed for facial analysis, offering pre-trained models for emotion detection and relying on TensorFlow for computational tasks.

OpenCV: A robust open-source library for computer vision, widely used for image and video processing tasks.

USAGE

Initial Steps

Git clone this repository Run: git clone https://github.com/SANGU1010/Facial_Emotion_Recognition.git Run: cd Facial-Emotion-Recognition-using-OpenCV-and-Deepface Install the required dependencies:

You can use pip install -r requirements.txt Or you can install dependencies individually:

pip install deepface

pip install tf_keras

pip install opencv-python

Download the Haar cascade XML file for face detection Run the code. Execute the Python script. The webcam will open, and real-time facial emotion detection will start. Emotion labels will be displayed on the frames around detected faces.

Approach

1.Import the necessary libraries: cv2 for video capture and image processing, and deepface for the emotion detection model.

2.Load the Haar cascade classifier XML file for face detection using cv2.CascadeClassifier().

3.Start capturing video from the default webcam using cv2.VideoCapture().

4.Enter a continuous loop to process each frame of the captured video.

5.Convert each frame to grayscale using cv2.cvtColor().

6.Detect faces in the grayscale frame using face_cascade.detectMultiScale().

7.For each detected face, extract the face ROI (Region of Interest).

8.Preprocess the face image for emotion detection using the deepface library's built-in preprocessing function.

9.Make predictions for the emotions using the pre-trained emotion detection model provided by the deepface library.

10.Retrieve the index of the predicted emotion and map it to the corresponding emotion label.

11.Draw a rectangle around the detected face and label it with the predicted emotion using cv2.rectangle() and cv2.putText().

12.Display the resulting frame with the labeled emotion using cv2.imshow().

13.If the 'q' key is pressed, exit the loop.

14.Release the video capture and close all windows using cap.release() and cv2.destroyAllWindows().

About

This project implements a real-time emotion recognition system using computer vision and deep learning techniques. It leverages OpenCV for video capture and face detection, along with the DeepFace library for emotion analysis. The system identifies and classifies emotions expressed by individuals captured through a webcam.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages