python图像人类检测_深度学习案例研究,以静态图像和实时方式检测七种人类面部表情之一...

本文介绍了一个实时面部表情识别项目,能够识别七种基本的人类表情:愤怒、厌恶、恐惧、快乐、中性、悲伤和惊讶。模型适用于静态图像和实时视频,通过HAAR级联检测面部并进行预测。数据集包括约1500张人类图片和9000张动画图片。为了实现低延迟,使用了Keras和OpenCV等库,并提供了训练和实时预测的代码。
摘要由CSDN通过智能技术生成

Real Time Facial Expression Recognition

5290ed149c655172bd70700dced65fea.png

Check out my blog on this case study at the following link:

Description

Computer animated agents and robots bring new dimension in human computer interaction which makes it vital as how computers can affect our social life in day-to-day activities. Face to face communication is a real-time process operating at a a time scale in the order of milliseconds. The level of uncertainty at this time scale is considerable, making it necessary for humans and machines to rely on sensory rich perceptual primitives rather than slow symbolic inference processes.

In this project we are presenting the real time facial expression recognition of seven most basic human expressions: ANGER, DISGUST, FEAR, HAPPY, NEUTRAL SAD, SURPRISE.

This model can be used for prediction of expressions of both still images and real time video. However, in both the cases we have to provide image to the model. In case of real time video the image should be taken at any point in time and feed it to the model for prediction of expression. The system automatically detects face using HAAR cascade then its crops it and resize the image to a specific size and give it to the model for prediction. The model will generate seven probability values corresponding to seven expressions. The highest probability value to the corresponding expression will be the predicted expression for that image.

Business Problem

However, our goal here is to predict the human expressions, but we have trained our model on both human and animated images. Since, we had only approx 1500 human images which are very less to make a good model, so we took approximately 9000 animated images and leverage those animated images for training the model and ultimately do the prediction of expressions on human images.

For better prediction we have decided to keep the size of each image 350*350.

For any image our goal is to predict the expression of the face in that image out of seven basic human expression

Problem Statement

CLASSIFY THE EXPRESSION OF FACE IN IMAGE OUT OF SEVEN BASIC HUMAN EXPRESSION

Source Data

We have downloaded data from 4 different sources.

Real-World Business Objective & Constraints

Low-latency is required.

Interpretability is important for still images but not in real time. For still images, probability of predicted expressions can be given.

Errors are not costly.

How to Run the Model

After downloading data from the aforementioned sources you have to structure the data into separate folders corresponding to the seven class labels. Then you can use the code in the file "FacialExpressionRecognition.ipynb" to train the model. You can add or delete layers in MLP part of the model based on your data and results. Don't forget to save your model after each epoch. Then for real time prediction you can run the file "Real_Time_Prediction.ipynb".

Prerequisites

You need to have installed following softwares and libraries in your machine before running this project.

Python 3

Anaconda: It will install ipython notebook and most of the libraries which are needed like sklearn, pandas, seaborn, matplotlib, numpy, PIL.

OpenCV

keras

Installing

OpenCV: pip install opencv-python

Keras: pip install keras

Built With

ipython-notebook - Python Text Editor

OpenCV - It is used for processing images

Keras - Deep Learning Library

Sklearn: It is a Machine Learning library but here it is used just to calculate accuracy and confusion matrix.

Authors

Gaurav Sharma - Complete work

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值