This project implements and evaluates four deep learning architectures for facial emotion recognition on the RAF-DB dataset:
- Convolutional Neural Network (Custom CNN)
- MobileNetV2
- EfficientNetB0
- ResNet18
The goal is to compare model performance in terms of classification accuracy, inference speed, and model size and to deploy the best-performing models in a browser-based real-time emotion recognition demo.
The project uses the Raf-DB (Real-world Affective Faces Database), which contains real-world facial images annotated with seven basic emotion labels.
Preprocessing steps include:
- Face alignment and resizing
- Data augmentation (rotation, flipping, etc.)
- Normalization for model compatibility
The RAF-DB dataset is publicly available via Kaggle for training and evaluation.
All training and evaluation were conducted in Google Colab, with GPU acceleration.
Each model is trained and benchmarked, and the results (accuracy scores, confusion matrices, and performance comparisons) are documented directly in the notebooks.
All notebooks run directly in Google Colab with GPU support.
-
MobileNetV2:
https://colab.research.google.com/drive/1Epq0YbM-MDjiAdSvqnl7fOrpdZYSywYr#scrollTo=87VDVa1eziFd -
EfficientNet-B0:
https://colab.research.google.com/drive/16-Ra3G_Rwnx3yB7YndqpA5rkmFln_WnK?usp=sharing -
ResNet18:
https://colab.research.google.com/drive/1GMzoBdbuyrXdY20VvuXb4bSMTmMJ6Z6R#scrollTo=JU-zhrdgzdRA
All dependencies install automatically when each notebook is run.
The executed notebooks with output cells are saved in the
ipynbfolder.
The following libraries are required for training and running the models (automatically available in Google Colab):
torchtorchvisionnumpymatplotlibcollections(standard library)time(standard library)google.colab(for file uploads/downloads)kaggle(for dataset download)
If running locally (not in Colab), install the key packages:
pip install torch torchvision numpy matplotlib
The web demo allows users to test emotion recognition in the browser using the device camera.
Download all files into a single directory before running.
- Open the project folder
- Double-click
index.html - Allow camera access when prompted
- Click Open Camera to begin recognition
- Switch models freely using the interface
- Click Stop Camera to end the session
Requires Python installed.
python -m http.server 8000
Visit in browser:
http://localhost:8000
- Open the project folder in VS Code
- Right-click
index.html - Select Open with Live Server
This project demonstrates how different neural network architectures perform on real-world facial emotion recognition tasks and how they can be deployed efficiently on the web.
It provides a complete pipeline from training → evaluation → deployment.