Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- computer-vision
|
| 5 |
+
- image-classification
|
| 6 |
+
- emotion-recognition
|
| 7 |
+
- facial-expression-recognition
|
| 8 |
+
- cnn
|
| 9 |
+
- keras
|
| 10 |
+
- tensorflow
|
| 11 |
+
pipeline_tag: image-classification
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Face Emotion Recognition CNN (v2)
|
| 15 |
+
|
| 16 |
+
## Model Description
|
| 17 |
+
Face Emotion Recognition CNN (v2) is a lightweight Convolutional Neural Network designed to classify facial expressions into seven basic emotion categories using grayscale facial images of size 48×48. The model is optimized for fast inference and practical deployment in real-time and resource-constrained environments.
|
| 18 |
+
|
| 19 |
+
The model was trained using the Adam optimizer and categorical cross-entropy loss, balancing performance and computational efficiency.
|
| 20 |
+
|
| 21 |
+
## Intended Use
|
| 22 |
+
This model is intended for:
|
| 23 |
+
- Facial emotion recognition from static images
|
| 24 |
+
- Human–computer interaction systems
|
| 25 |
+
- Emotion-aware applications
|
| 26 |
+
- Academic research and educational projects
|
| 27 |
+
|
| 28 |
+
### Out-of-Scope Use
|
| 29 |
+
The model should not be used for:
|
| 30 |
+
- Surveillance, biometric identification, or user profiling
|
| 31 |
+
- Medical, psychological, or legal decision-making
|
| 32 |
+
- Any high-risk or safety-critical applications
|
| 33 |
+
|
| 34 |
+
## Model Architecture
|
| 35 |
+
- Architecture Type: Convolutional Neural Network (CNN)
|
| 36 |
+
- Input: Grayscale facial images (48 × 48)
|
| 37 |
+
- Output: Probability distribution over 7 emotion classes
|
| 38 |
+
- Optimizer: Adam
|
| 39 |
+
- Loss Function: Categorical Crossentropy
|
| 40 |
+
|
| 41 |
+
## Training Configuration
|
| 42 |
+
- Image Size: 48 × 48
|
| 43 |
+
- Batch Size: 64
|
| 44 |
+
- Epochs: 40
|
| 45 |
+
- Learning Rate: 0.0005
|
| 46 |
+
- Number of Classes: 7
|
| 47 |
+
- Model Name: face_emotion_cnn_v2
|
| 48 |
+
|
| 49 |
+
## Emotion Labels
|
| 50 |
+
| Label ID | Emotion |
|
| 51 |
+
|--------:|-----------|
|
| 52 |
+
| 0 | Angry |
|
| 53 |
+
| 1 | Disgust |
|
| 54 |
+
| 2 | Fear |
|
| 55 |
+
| 3 | Happy |
|
| 56 |
+
| 4 | Neutral |
|
| 57 |
+
| 5 | Sad |
|
| 58 |
+
| 6 | Surprise |
|
| 59 |
+
|
| 60 |
+
## Dataset
|
| 61 |
+
The model was trained on a facial emotion dataset containing grayscale face images resized to 48×48 pixels. Images were preprocessed using normalization and face alignment where applicable. The dataset includes seven emotion categories.
|
| 62 |
+
|
| 63 |
+
Note: Dataset composition and demographic distribution may influence model bias and generalization.
|
| 64 |
+
|
| 65 |
+
## Evaluation
|
| 66 |
+
The model was evaluated on a held-out test set with the following results:
|
| 67 |
+
|
| 68 |
+
### Training Performance (Final Epoch)
|
| 69 |
+
- Accuracy: 0.5976
|
| 70 |
+
- Loss: 1.1217
|
| 71 |
+
|
| 72 |
+
### Test Performance
|
| 73 |
+
- Test Accuracy: 0.5942
|
| 74 |
+
|
| 75 |
+
These results reflect moderate performance, which is typical for compact CNN models trained on low-resolution facial emotion datasets.
|
| 76 |
+
|
| 77 |
+
## Usage
|
| 78 |
+
### Inference Example
|
| 79 |
+
```python
|
| 80 |
+
from transformers import pipeline
|
| 81 |
+
|
| 82 |
+
classifier = pipeline(
|
| 83 |
+
task="image-classification",
|
| 84 |
+
model="your-username/face_emotion_cnn_v2"
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
predictions = classifier("face.jpg")
|
| 88 |
+
print(predictions)
|