Downloads · 30 days
6
5% of all-time downloads
Dafisns/human-emotion-recognition
human-emotion-recognition is a image classification model from Dafisns. Use it when you need a label for an image. It is set up for keras. The card lists the license as mit.
Deep learning models for classifying human facial emotions.
Downloads · 30 days
6
5% of all-time downloads
All-time downloads
110
Public
Repo size
18.9 MB
Likes
0
Public
Click a slice to open those files.
.h513.4 MB · 71%
From the Hugging Face model README
Deep learning models for classifying human facial emotions.
| Model | Test Accuracy | Test Loss | Epochs |
|---|---|---|---|
| Base CNN | 92.41% | 0.268 | 33 |
| MobileNetV3Small | 81.56% | 0.551 | 50 |
🏆 Best model: Base CNN with 92.41% test accuracy
| File | Format | Input Size | Description |
|---|---|---|---|
model_base.h5 | Keras H5 | 128x128x1 | Custom CNN (Grayscale) |
model_transfer_learning.keras | Keras | 224x224x3 | MobileNetV3Small (RGB) |
tflite/best_model.tflite | TFLite | 128x128x1 | Mobile/Edge |
tfjs_model/ | TF.js | 128x128x1 | Web deployment |
from huggingface_hub import hf_hub_download
import tensorflow as tf
import numpy as np
# Download model
model_path = hf_hub_download(
repo_id="dafisnadhif/human-emotion-recognition",
filename="model_base.h5"
)
# Load model
model = tf.keras.models.load_model(model_path)
# Predict
CLASS_NAMES = ['Angry', 'Fear', 'Happy', 'Sad', 'Surprise']
predictions = model.predict(img_batch)
print(CLASS_NAMES[np.argmax(predictions[0])])
from huggingface_hub import hf_hub_download
import tensorflow as tf
tflite_path = hf_hub_download(
repo_id="dafisnadhif/human-emotion-recognition",
filename="tflite/best_model.tflite"
)
interpreter = tf.lite.Interpreter(model_path=tflite_path)
interpreter.allocate_tensors()
const model = await tf.loadLayersModel(
'https://huggingface.co/dafisnadhif/human-emotion-recognition/resolve/main/tfjs_model/model.json'
);
| Parameter | Value |
|---|---|
| Dataset | Human Face Emotions |
| Images | ~47,000 facial images |
| Source Code | GitHub |
| Framework | TensorFlow 2.x / Keras |
| Optimizer | AdamW (lr=1e-3, weight_decay=1e-4) |
| Loss | Sparse Categorical Crossentropy |
| Batch Size | 256 |
| Callbacks | EarlyStopping (patience=8), ReduceLROnPlateau |
MIT License
Dafis Nadhif Saputra