Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- emotion-detection
|
| 4 |
+
- tflite
|
| 5 |
+
- facial-expression
|
| 6 |
+
- computer-vision
|
| 7 |
+
license: mit
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Meme Emotion Detector 🎭
|
| 11 |
+
|
| 12 |
+
TFLite model untuk deteksi ekspresi wajah real-time dengan 7 emosi.
|
| 13 |
+
|
| 14 |
+
## Model Details
|
| 15 |
+
|
| 16 |
+
- **Model Type:** TensorFlow Lite
|
| 17 |
+
- **Task:** Image Classification (Facial Expression Recognition)
|
| 18 |
+
- **Emotions:** angry, disgust, fear, happy, sad, surprise, neutral
|
| 19 |
+
- **Input:** 48x48 grayscale image
|
| 20 |
+
- **Framework:** TensorFlow Lite
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
from huggingface_hub import hf_hub_download
|
| 26 |
+
import tensorflow as tf
|
| 27 |
+
import numpy as np
|
| 28 |
+
|
| 29 |
+
# Download model
|
| 30 |
+
model_path = hf_hub_download(
|
| 31 |
+
repo_id="maftuh-main/meme-emotion-detector",
|
| 32 |
+
filename="model.tflite"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
# Load TFLite model
|
| 36 |
+
interpreter = tf.lite.Interpreter(model_path=model_path)
|
| 37 |
+
interpreter.allocate_tensors()
|
| 38 |
+
|
| 39 |
+
# Get input/output details
|
| 40 |
+
input_details = interpreter.get_input_details()
|
| 41 |
+
output_details = interpreter.get_output_details()
|
| 42 |
+
|
| 43 |
+
# Prepare image (48x48 grayscale, normalized)
|
| 44 |
+
# face_img = ... (your face image)
|
| 45 |
+
# face_resized = cv2.resize(face_img, (48, 48))
|
| 46 |
+
# face_gray = cv2.cvtColor(face_resized, cv2.COLOR_BGR2GRAY)
|
| 47 |
+
# face_input = face_gray.astype(np.float32) / 255.0
|
| 48 |
+
# face_input = np.expand_dims(face_input, axis=[0, -1])
|
| 49 |
+
|
| 50 |
+
# Run inference
|
| 51 |
+
# interpreter.set_tensor(input_details[0]['index'], face_input)
|
| 52 |
+
# interpreter.invoke()
|
| 53 |
+
# predictions = interpreter.get_tensor(output_details[0]['index'])[0]
|
| 54 |
+
|
| 55 |
+
# Get emotion
|
| 56 |
+
emotions = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral']
|
| 57 |
+
# emotion_idx = np.argmax(predictions)
|
| 58 |
+
# detected_emotion = emotions[emotion_idx]
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Training
|
| 62 |
+
|
| 63 |
+
Model trained on FER2013 dataset atau custom facial expression dataset.
|
| 64 |
+
|
| 65 |
+
## Files
|
| 66 |
+
|
| 67 |
+
- `model.tflite` - TensorFlow Lite model (1.4 MB)
|
| 68 |
+
|
| 69 |
+
## Applications
|
| 70 |
+
|
| 71 |
+
- Real-time emotion detection
|
| 72 |
+
- Meme/emoji overlay based on expression
|
| 73 |
+
- Interactive applications
|
| 74 |
+
- Computer vision projects
|
| 75 |
+
|
| 76 |
+
## License
|
| 77 |
+
|
| 78 |
+
MIT License
|