Downloads · 30 days
764
30% of all-time downloads
pat229988/AffectNet-face-to-emotion-tflite
AffectNet-face-to-emotion-tflite is a image classification model from pat229988. Use it when you need a label for an image. It is set up for tensorflow-lite. The card lists the license as mit.
This repository contains a TensorFlow Lite float32 conversion of the static image face emotion recognition model from ElenaRyumina/faceemotionrecognition.
Downloads · 30 days
764
30% of all-time downloads
All-time downloads
2.5K
Public
Repo size
98.2 MB
Likes
0
Public
Click a slice to open those files.
.tflite98.2 MB · 100%
From the Hugging Face model README
This repository contains a TensorFlow Lite float32 conversion of the static image face emotion recognition model from ElenaRyumina/face_emotion_recognition.
The model predicts one of seven facial emotion classes from an RGB face image.
| File | Description |
|---|---|
emo_affectnet_static_float32.tflite | Converted TensorFlow Lite model. |
labels.txt | Output labels in model order. |
conversion_report.json | Conversion metadata and PyTorch-vs-TFLite parity check. |
infer_tflite.py | Minimal Python inference example. |
requirements.txt | Python dependencies for the inference example. |
ElenaRyumina/face_emotion_recognitionElenaRyumina/EMO-AffectNetModel[1, 224, 224, 3], float32, pixel range 0..255[1, 7]; apply softmax outside the modelThe output logits use this label order:
Install the example dependencies:
pip install -r requirements.txt
Run inference on a face image:
python infer_tflite.py --image path/to/face.jpg
Example output:
{
"top_label": "Happiness",
"top_score": 0.9123,
"predictions": [
{"label": "Happiness", "score": 0.9123},
{"label": "Neutral", "score": 0.0531},
{"label": "Surprise", "score": 0.0214}
]
}
The TFLite model expects:
float32.[1, 224, 224, 3].Do not normalize to 0..1 unless you reconvert the model with a different input convention.
The conversion report records a parity check between the converted model and the source PyTorch model:
31.4901161193847656e-065.336921825952837e-071.0See conversion_report.json for the full metadata.
This folder is ready to upload as a Hugging Face model repository.
Recommended upload flow:
pip install -U huggingface_hub
hf auth login
hf repos create <namespace>/<repo-name>
hf upload <namespace>/<repo-name> . . --repo-type model --exclude ".serena/*" --exclude "__pycache__/*"
If you publish with Git instead of huggingface-cli upload, install Git LFS first so the .tflite file is stored correctly:
git lfs install
git init
git add .
git commit -m "Add TFLite face emotion recognition model"
git remote add origin https://huggingface.co/<namespace>/<repo-name>
git push -u origin main
If you use the original Emo-AffectNet model in research, cite the source paper:
@article{RYUMINA2022,
title = {In Search of a Robust Facial Expressions Recognition Model: A Large-Scale Visual Cross-Corpus Study},
author = {Elena Ryumina and Denis Dresvyanskiy and Alexey Karpov},
journal = {Neurocomputing},
year = {2022},
doi = {10.1016/j.neucom.2022.10.013},
url = {https://www.sciencedirect.com/science/article/pii/S0925231222012656}
}
The source model and original project are licensed under the MIT License. This converted TFLite repository keeps the same license. See LICENSE and NOTICE.md.