File size: 1,362 Bytes
cf65431
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
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