Coders Packet

Emotion Detection using python

By Vinit Kumar Mahato

The main objective of this project is to enable users to observe their detected emotions on the screen. This basically focuses on analyzing emotions in human faces using python library DeepFace.

Step 1: Import Necessary Libraries

import cv2
from deepface import DeepFace

Step 2: Initialize Haar Cascade Classifier for Face Detection

faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')

Step 3: Set Up Video Capture

cap = cv2.VideoCapture(0)

Step 4: Emotion Detection and Display

each video frame will be in a loop, detect faces using the Haar Cascade classifier, and analyze emotions using DeepFace. If a face is detected and emotion analysis is successful then, we retrieve the dominant emotion and display it on the video frame.

Step 5: Release Resources and Close Windows

cap.release()
cv2.destroyAllWindows()

 

Output (Screenshots) :
static image - photo (3)

Output

The Emotion Detection project successfully combines face detection with emotion analysis using DeepFace. As per my experience it may work for the real-time application as it can captures video from the camera, detects faces, and displays the dominant emotion on the video frame. Then, users can observe their detected emotions in real-time basis. Which may further useful for the society

Source code: zip folder

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Vinit Kumar Mahato (vinit112)

Download packets of source code on Coders Packet