Emotion Detection using Artificial Intelligence presentation by Aryan Trisal.
In this ppt you will learn about emotion detection using AI and how will it change the world.
IF U WANT A PPT MADE AT VERY LOW PRICES CONTACT ME ON LINKEDIN -www.linkedin.com/in/aryan-trisal-420253190
2. In this Presentation
Here's what we have covered:
Introduction
Problems Faced
Solutions
Need for the proposed system
Implementation
Code
Future Scope
3. Introduction
Facial expression is an essential part of
communication. For this reason, the issue of
human emotions evaluation using a computer is a
very interesting topic, which has gained more and
more attention in recent years. It is mainly related
to the possibility of applying facial expression
recognition in many fields such as HCI, video
games, virtual reality, and analysing customer
satisfaction etc. Emotion’s determination
(recognition process) is often performed in 3 basic
phases: face detection, facial features extraction,
and last stage - expression classification.
4. Facial emotion
recognition is a
complex task and
the machine
learning approach
to recognize faces
requires several
steps to perform
it, some are:
Feature selection: This stage refers to attribute
selection for the training of the machine learning
algorithm. The process includes the selection of
predictors for construction of the learning system
Feature classification: When it comes to
supervised learning algorithms, classification
consists of two stages. Training and classification,
where training helps in discovering which features
are helpful in classification.
Feature extraction:Machine learning requires
numerical data for learning and training. During
feature extraction, processing is done to
transform arbitrary data, text or images, to gather
the numerical data
Classifiers:This is the final step in this process.
Based on the inference from the features, the
algorithm performs data classification.
5. Problems Faced
Technical challenges
Emotion recognition shares a lot of challenges with detecting moving
objects in the video identifying an object, continuous detection,
incomplete or unpredictable actions, etc.
Data augmentation
As with any machine learning and deep learning algorithms, ER solutions
require a lot of training data. This data must include videos at various
frame rates, from various angles, with various backgrounds, with people
of different genders, nationalities, and races, etc.
6. Solutions
1.Create your own dataset: This is the most
expensive and time-consuming way, but you’ll end
up with a dataset perfectly suited for your task.
2.Combine several datasets: You can cross-check
the performance of your solution on several other
datasets.
3.Modify the data as you go: Some researchers
suggest editing videos that you’ve already used:
crop them, change the lighting, slow them down,
speed them up, add noise, etc.
7. Need for the proposed system
Detecting emotions with technology is quite a challenging task, yet one where machine
learning algorithms have shown great promise. By using Facial Emotion Detection,
businesses can process images, and videos in real-time for monitoring video feeds or
automating video analytics, thus saving costs and making life better for their users. Some
examples are given below:
Emotion recognition in video game testing
Automotive industry and emotion recognition
Emotion recognition in Health Care
8. Implementation
Tools and Libraries used
OpenCV
OpenCV is the library we
will be using for image
transformation functions
such as converting the
image to grayscale
Deep Learning
Deep learning is a subset
of machine learning in
artificial intelligence that
has networks capable of
learning unsupervised from
data that is unstructured
or unlabelled
NumPy
NumPy is a library for the
Python programming
language, adding support
for large, multi-
dimensional arrays
Keras
Keras is an open-source
software library that
provides a Python
interface for artificial
neural networks.
Python
Python is a powerful
scripting language and is
very useful for solving
statistical problems
involving machine learning
algorithms
9. CODE
from keras.models import load_model
from time import sleep
from keras.preprocessing.image import img_to_array
from keras.preprocessing import image
import cv2
import numpy as np
face_classifier =
cv2.CascadeClassifier('./haarcascade_frontalface_default.xml')
classifier =load_model('./Emotion_Detection.h5')
class_labels = ['Angry','Happy','Neutral',]
cap = cv2.VideoCapture(0)
while True:
# Grab a single frame of video
ret, frame = cap.read()
labels = []
gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
faces = face_classifier.detectMultiScale(gray,1.3,5)
for (x,y,w,h) in faces:
cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,0),2)
roi_gray = gray[y:y+h,x:x+w]
roi_gray = cv2.resize(roi_gray,(48,48),interpolation=cv2.INTER_AREA)
if np.sum([roi_gray])!=0:
roi = roi_gray.astype('float')/255.0
roi = img_to_array(roi)
roi = np.expand_dims(roi,axis=0)
# make a prediction on the ROI, then lookup the class
preds = classifier.predict(roi)[0]
print("nprediction = ",preds)
label=class_labels[preds.argmax()]
print("nprediction max = ",preds.argmax())
print("nlabel = ",label)
label_position = (x,y)
cv2.putText(frame,label,label_position,cv2.FONT_HERSHEY_SIMPLEX,2,
(0,255,0),3)
else:
cv2.putText(frame,'No Face Found',
(20,60),cv2.FONT_HERSHEY_SIMPLEX,2,(0,255,0),3)
print("nn")
cv2.imshow('Emotion Detector',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release() cv2.destroyAllWindows()
10. FUTURE SCOPE
Automotive Safety and Research Systems:
For the safety of the driver and passengers by recognizing the facial expression of the driver.
Medical Research into Autism:
Ability to read the facial expression of people with autism and finding the best solutions for
them.
Market Research:
Facial expression marketing to help get the necessary information regarding respective
trends.
Pay-per-Laugh:
Faced with rising ticket prices and declining audiences in 2014, a Spanish theatre
experimented with charging audiences 30 cents a laugh for its comedy shows, installing
emotion recognition cameras in front of each seat, and fixing a ceiling of 24 euros per
customer for the more successful events.