Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- facial-emotion-recognition
|
| 5 |
+
- computer-vision
|
| 6 |
+
- tensorflow
|
| 7 |
+
- keras
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Facial Emotion Detection Model
|
| 12 |
+
|
| 13 |
+
A lightweight deep learning model that classifies facial expressions into 7 emotion categories.
|
| 14 |
+
|
| 15 |
+
## Model Details
|
| 16 |
+
|
| 17 |
+
- **Model type:** Image Classification
|
| 18 |
+
- **Architecture:** ResNet50-based
|
| 19 |
+
- **Input:** 224x224 RGB images
|
| 20 |
+
- **Output:** 7 emotion classes
|
| 21 |
+
- **Accuracy:** 85.60%
|
| 22 |
+
|
| 23 |
+
## Emotion Classes
|
| 24 |
+
|
| 25 |
+
- π Angry
|
| 26 |
+
- π€’ Disgust
|
| 27 |
+
- π¨ Fear
|
| 28 |
+
- π Happy
|
| 29 |
+
- π Neutral
|
| 30 |
+
- π’ Sad
|
| 31 |
+
- π² Surprise
|
| 32 |
+
|
| 33 |
+
## Quick Start
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from tensorflow.keras.models import load_model
|
| 37 |
+
from PIL import Image
|
| 38 |
+
import numpy as np
|
| 39 |
+
|
| 40 |
+
# Load model
|
| 41 |
+
model = load_model('Facial_Emotion_Detection_Model.h5')
|
| 42 |
+
|
| 43 |
+
# Preprocess image
|
| 44 |
+
img = Image.open('face.jpg').convert('RGB').resize((224, 224))
|
| 45 |
+
x = np.array(img) / 255.0
|
| 46 |
+
x = np.expand_dims(x, axis=0)
|
| 47 |
+
|
| 48 |
+
# Predict
|
| 49 |
+
predictions = model.predict(x)
|
| 50 |
+
emotion = ['angry', 'disgust', 'fear', 'happy', 'neutral', 'sad', 'surprise'][np.argmax(predictions)]
|
| 51 |
+
confidence = np.max(predictions)
|
| 52 |
+
|
| 53 |
+
print(f"Emotion: {emotion} ({confidence:.2%})")
|
| 54 |
+
Usage
|
| 55 |
+
Ideal for:
|
| 56 |
+
|
| 57 |
+
Emotion analysis applications
|
| 58 |
+
|
| 59 |
+
Human-computer interaction
|
| 60 |
+
|
| 61 |
+
Customer sentiment analysis
|
| 62 |
+
|
| 63 |
+
Research projects
|
| 64 |
+
|
| 65 |
+
Limitations
|
| 66 |
+
Best with frontal face images
|
| 67 |
+
|
| 68 |
+
Performance varies with image quality
|
| 69 |
+
|
| 70 |
+
Cultural differences may affect accuracy
|
| 71 |
+
|
| 72 |
+
License: Apache 2.0
|