|
|
--- |
|
|
language: en |
|
|
tags: |
|
|
- facial-emotion-recognition |
|
|
- computer-vision |
|
|
- tensorflow |
|
|
- keras |
|
|
license: apache-2.0 |
|
|
--- |
|
|
|
|
|
# Facial Emotion Detection Model |
|
|
|
|
|
A lightweight deep learning model that classifies facial expressions into 7 emotion categories. |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Model type:** Image Classification |
|
|
- **Architecture:** ResNet50-based |
|
|
- **Input:** 224x224 RGB images |
|
|
- **Output:** 7 emotion classes |
|
|
- **Accuracy:** 85.60% |
|
|
|
|
|
## Emotion Classes |
|
|
|
|
|
- π Angry |
|
|
- π€’ Disgust |
|
|
- π¨ Fear |
|
|
- π Happy |
|
|
- π Neutral |
|
|
- π’ Sad |
|
|
- π² Surprise |
|
|
|
|
|
## Quick Start |
|
|
|
|
|
```python |
|
|
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 |