MACHINE LEARNING PROJECT

Facial Emotion Detection

A machine-learning system that compares multiple neural network architectures to classify facial expressions as angry, happy, sad, surprised, or neutral.

PythonTensorFlowKerasOpenCVdlib
😊

FACIAL ANALYSIS

01

The Problem

Facial expressions can be difficult to interpret during virtual communication. This project explores whether machine learning can automatically recognize common emotional states.

02

The Data

Facial images are converted into grayscale pixel arrays and categorized into five emotion classes. Invalid samples are removed before creating training and testing datasets.

03

The Models

The project compares a pixel-based MLP, a facial-landmark neural network, and a convolutional neural network that learns spatial image features.

04

The Evaluation

Each model is evaluated using test accuracy, validation loss, training curves, confidence scores, and a five-class confusion matrix.

INTERACTIVE WALKTHROUGH

Explore the classification pipeline

Select a model and sample expression, then run the walkthrough to see how an image moves through the system.

1. Select a model

The convolutional neural network examines nearby groups of pixels to learn facial patterns such as mouth shape, eyebrow position, and eye structure.

2. Select a sample expression

3. Or upload an image

Uploaded images are displayed locally and are not sent to a server.

STAGE 1

Facial Image Input

The model begins with a 48 × 48 grayscale facial image. Reducing the image to grayscale allows the model to focus on facial structure rather than color.

😊
DEMONSTRATION RESULT

HAPPY

86%
HAPPY86%
NEUTRAL7%
SURPRISE4%
SAD2%
ANGRY1%

These scores demonstrate how model output is visualized. They are not generated by live inference.

MODEL COMPARISON

Three approaches to the same problem

01

Pixel MLP

Standardized image pixels are flattened into a feature vector and passed through fully connected neural-network layers.

Pixels → Dense Layers → Softmax
02

Facial Landmarks

Sixty-eight facial coordinates represent important locations around the eyes, nose, jaw, eyebrows, and mouth.

Coordinates → Dense Layers → Softmax
03

Convolutional Network

Convolution, normalization, pooling, and dropout layers learn progressively more complex visual patterns.

Image → Convolution → Classification