Downloads · 30 days
10
9% of all-time downloads
PSewmuthu/resnet50-emotion-recognition-ckplus-rafdb
resnet50-emotion-recognition-ckplus-rafdb is a machine learning model from PSewmuthu. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for tensorflow. The card lists the license as apache-2.0.
This repository presents a fine-tuned ResNet50-based Emotion Recognition model trained on the CK+ and RAF-DB facial expression datasets. The model classifies facial emotions into seven categories and provides high acc…
Downloads · 30 days
10
9% of all-time downloads
All-time downloads
114
Public
Repo size
312 MB
Likes
0
Public
Click a slice to open those files.
.h5287 MB · 92%
From the Hugging Face model README
This repository presents a fine-tuned ResNet50-based Emotion Recognition model trained on the CK+ and RAF-DB facial expression datasets. The model classifies facial emotions into seven categories and provides high accuracy and generalization through a two-phase fine-tuning process. Both TensorFlow and TensorFlow Lite versions are available for deployment on cloud and edge devices.
This model forms a key component of an AI-powered, emotion-aware sign language translation system, enabling real-time emotion recognition and integration into affective computing pipelines.
The architecture is built on ResNet50, pre-trained on ImageNet, and fine-tuned in two stages:
Stage 1 – Frozen Base Training (10 Epochs):
Stage 2 – Unfrozen Base Fine-Tuning (30 Epochs):
| Parameter | Description |
|---|---|
| Base Model | ResNet50 (Pre-trained on ImageNet) |
| Optimizer | Adam |
| Learning Rate | 1e-4 (unfrozen phase) |
| Loss Function | Sparse Categorical Crossentropy |
| Batch Size | 32 |
| Epochs | 40 (10 + 30) |
| Image Size | 224x224 |
| Metric | Training | Validation | Testing |
|---|---|---|---|
| Accuracy | 98.43% | 86.05% | 81.65% |
| Loss | 0.0610 | 0.7748 | 1.1962 |
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| 0 | 0.74 | 0.69 | 0.72 |
| 1 | 0.53 | 0.49 | 0.51 |
| 2 | 0.88 | 0.31 | 0.46 |
| 3 | 0.93 | 0.90 | 0.91 |
| 4 | 0.74 | 0.87 | 0.80 |
| 5 | 0.77 | 0.75 | 0.76 |
| 6 | 0.82 | 0.83 | 0.82 |
Overall Accuracy: 81.65% Weighted F1-Score: 0.81
Graph 1: Training and Validation Accuracy vs Epochs

Graph 2: Training and Validation Loss vs Epochs

Graph 3: Original Dataset Class Distribution

Graph 4: Balanced (Augmented) Dataset Class Distribution

Graph 5: Multi-Class ROC Curves (AUC per class)

Graph 6: Confusion Matrix (Heatmap)

Graph 7: Sample Test Results (5 predictions per class)

These visualizations demonstrate consistent learning, balanced data, and strong class-wise recognition.
| File | Description |
|---|---|
emotion_resnet50_model.h5 | Full TensorFlow model (≈273 MB) |
emotion_resnet50_optimized.tflite | Optimized TensorFlow Lite model (≈23 MB) for mobile deployment |
import tensorflow as tf
from tensorflow.keras.preprocessing import image
import numpy as np
# Load original model
model_path = 'emotion_resnet50_model.h5'
model = tf.keras.models.load_model(model_path)
# Prepare input
img = image.load_img('test_face.jpg', target_size=(224, 224))
input_data = np.expand_dims(image.img_to_array(img) / 255.0, axis=0)
# Run inference
pred = model.predict(input_data)
classes = ['Angry', 'Disgust', 'Fear', 'Happy', 'Neutral', 'Sad', 'Surprise']
print("Original Model Prediction:", classes[np.argmax(pred)])
# Load and run TFLite optimized model
tflite_model_path = 'emotion_resnet50_optimized.tflite'
interpreter = tf.lite.Interpreter(model_path=tflite_model_path)
interpreter.allocate_tensors()
input_index = interpreter.get_input_details()[0]['index']
output_index = interpreter.get_output_details()[0]['index']
interpreter.set_tensor(input_index, input_data.astype(np.float32))
interpreter.invoke()
output = interpreter.get_tensor(output_index)
print("TFLite Model Prediction:", classes[np.argmax(output)])
emotion-recognition resnet50 facial-expression deep-learning tensorflow tflite ckplus rafdb computer-vision affective-computing fine-tuning
@misc{pasindu_sewmuthu_abewickrama_singhe_2025,
author = { Pasindu Sewmuthu Abewickrama Singhe },
title = { resnet50-emotion-recognition-ckplus-rafdb (Revision 3216038) },
year = 2025,
url = { https://huggingface.co/PSewmuthu/resnet50-emotion-recognition-ckplus-rafdb },
doi = { 10.57967/hf/6653 },
publisher = { Hugging Face }
}
Author: P.S. Abewickrama Singhe
Developed with: TensorFlow + Keras
License: Apache-2.0
Date: October 2025
Email: [email protected]