Face Expression Detector with ResEmoteNet

Facial expression recognition, combining Haar Cascade face detection with a ResEmoteNet classifier.

Source
Neutral, confidence 0.99
Neutral, confidence 0.99
Neutral, confidence 1.00
Neutral, confidence 1.00
Angry, confidence 0.96
Angry, confidence 0.96
Angry, confidence 0.76
Angry, confidence 0.76
Happy, confidence 0.80
Happy, confidence 0.80
Surprise, confidence 0.94
Surprise, confidence 0.94

Overview

A program that finds faces in an image or video feed and classifies the expression on each one, for emotion recognition.

How it works

It runs as a two-stage pipeline:

  1. Face detection. OpenCV’s Haar Cascade classifier locates faces in each frame and crops them out.
  2. Expression classification. Each face crop is passed to ResEmoteNet, a CNN for facial emotion recognition, implemented in PyTorch, which predicts the expression class.

Splitting detection from classification keeps each stage simple: the cheap detector does the searching, and the network only ever sees a tightly cropped face.

Stack

Python · PyTorch · OpenCV