The Facial Emotion Recognition (FER) Model is a Convolutional Neural Network trained on the FER-2013 dataset to classify human facial expressions into seven emotion categories:
- Angry
- Disgust
- Fear
- Happy
- Sad
- Surprise
- Neutral
This model is deployed using FastAPI, Streamlit, Docker, and Kubernetes, and tracked using MLflow. Prediction logs are stored using Snowflake for enterprise-grade MLOps.
To provide real-time emotion recognition for:
- Education tools
- Interactive AI demos
- User behavior research
- Human–computer interaction (HCI)
- Wellness monitoring applications
- Social robotics
- UX or product analytics
- Law enforcement
- Hiring decision tools
- Predicting personality
- Medical diagnosis
- Legal or governmental use
- Automated surveillance
- High-stakes decision-making
This model should never be used as the sole decision-maker for any sensitive task.
- Architecture: CNN (Convolutional Neural Network)
- Framework: TensorFlow/Keras
- Input: 48×48 grayscale images
- Output: 7-class softmax probability distribution
Logged in MLflow:
✔ Model architecture ✔ Parameters ✔ Metrics ✔ Training loss curves ✔ Confusion matrix ✔ Artifacts (history.json)
Dataset: FER-2013 (public Kaggle dataset)
- Large dataset (~35,000 images)
- Multiple classes
- Standard benchmark in Computer Vision
- Dataset skews toward younger faces
- Overrepresentation of certain ethnic groups
- Limited lighting variations
- Some images mislabeled
- Grayscale only
Emotion recognition is an area with well-documented ethical risks, including:
Studies show FER datasets often underrepresent:
- Darker skin tones
- Older adults
- Certain ethnic backgrounds
This can cause misclassification.
Emotions are expressed differently across:
- Culture
- Gender
- Region
- Social norms
This model does not account for cultural variation.
FER models can be misused in:
- Workplace surveillance
- Student behavior scoring
- Criminal profiling
- Automated “emotion-based decisions”
This model must not be deployed in these contexts.
- Accuracy
- Validation accuracy
- Precision, Recall, F1-score (optional)
- Confusion matrix
- Loss curves
(Note: These are reference-level until you run eval)
- Overall Accuracy: 0.64–0.72 typical range
- Best accuracy tends to be on: Happy, Surprise
- Lowest accuracy typically on: Disgust, Fear, Angry
You may include exact numbers after running your model evaluation script.
This model struggles with:
- Occluded faces (masks, glasses, hats)
- Low lighting
- Extreme angles
- Blurry images
- Cultural expression differences
- Mixed or ambiguous expressions
- Micro-expressions
- Faces not centered or cropped
The model expects clean, centered, front-facing 48×48 grayscale faces.
- FastAPI for inference
- Streamlit for UI
- Docker containerization
- Kubernetes deployment with LoadBalancer
- MLflow experiment tracking
- Snowflake prediction logging
- GPU optional
POST /predict- Accepts image upload
- Returns predicted emotion + confidence score
This system:
✔ Does not store user images locally ✔ Logs only label + confidence to Snowflake ✔ Uses Snowflake Secrets (env vars) ✔ Uses HTTPS when deployed ✔ Can anonymize all metadata
- Upgrade to a deeper CNN or ViT
- Bias reduction via dataset balancing
- Add adversarial robustness
- Add face detection preprocessor
- Add calibration for confidence scores
- Improve evaluation suite
- Add multilingual documentation