Downloads · 30 days
0
AtharAbbas993/Facial_Emotion_Detection
Facial_Emotion_Detection is a machine learning model from AtharAbbas993. 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 keras. The card lists the license as apache-2.0.
A lightweight deep learning model that classifies facial expressions into 7 emotion categories.
Downloads · 30 days
0
Access
Public
Updated Oct 2, 2025
Repo size
296 MB
Likes
0
Public
Click a slice to open those files.
.h5296 MB · 100%
From the Hugging Face model README
A lightweight deep learning model that classifies facial expressions into 7 emotion categories.
from tensorflow.keras.models import load_model
from PIL import Image
import numpy as np
# Load model
model = load_model('Facial_Emotion_Detection_Model.h5')
# Preprocess image
img = Image.open('face.jpg').convert('RGB').resize((224, 224))
x = np.array(img) / 255.0
x = np.expand_dims(x, axis=0)
# Predict
predictions = model.predict(x)
emotion = ['angry', 'disgust', 'fear', 'happy', 'neutral', 'sad', 'surprise'][np.argmax(predictions)]
confidence = np.max(predictions)
print(f"Emotion: {emotion} ({confidence:.2%})")
Usage
Ideal for:
Emotion analysis applications
Human-computer interaction
Customer sentiment analysis
Research projects
Limitations
Best with frontal face images
Performance varies with image quality
Cultural differences may affect accuracy
License: Apache 2.0