File size: 2,214 Bytes
592e904
 
 
 
 
 
 
 
 
 
 
f8f5549
 
 
 
 
 
bc745c3
f8f5549
5ea911c
 
f8f5549
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc745c3
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
---
title: Facial Emotion Detector
emoji: 🎭
colorFrom: purple
colorTo: indigo
sdk: gradio
sdk_version: "3.50.2"
app_file: app.py
pinned: false
---

# 🎭 End-to-End Facial Emotion Recognition

 <!-- Replace with a link to your final app screenshot -->

This repository contains a complete, end-to-end MLOps pipeline and a production-ready web application for real-time facial emotion recognition. The project leverages a state-of-the-art Vision Transformer model and is deployed as a user-friendly Gradio application on Hugging Face Spaces.

**Live Demo:** [πŸš€ Click here to try the application on Hugging Face Spaces!](https://huggingface.co/spaces/ALYYAN/Emotion-Recognition) <!-- Replace with your HF Space URL -->

---

## ✨ Features

-   **Real-time Emotion Detection:** Analyzes your webcam feed to predict emotions in real-time.
-   **High Accuracy:** Powered by a pre-trained Swin Transformer model fine-tuned on the massive AffectNet dataset for superior performance on "in the wild" faces.
-   **Static Image & Video Analysis:** Upload your own images or videos for emotion prediction.
-   **Polished UI:** A professional and responsive user interface with an animated background, built with Gradio.
-   **Reproducible MLOps Pipeline:** The entire model training and data processing workflow is managed by DVC, ensuring 100% reproducibility.
-   **Containerized for Deployment:** The application is packaged with Docker for easy and consistent deployment anywhere.

## πŸ› οΈ Tech Stack

-   **Model:** Swin Transformer (`PangPang/affectnet-swin-tiny-patch4-window7-224`)
-   **ML/Ops:** Python, TensorFlow/Keras, DVC, MLflow, Hugging Face `transformers`
-   **Backend & UI:** Gradio
-   **Face Detection:** MTCNN
-   **Deployment:** Hugging Face Spaces, Docker

## πŸš€ Getting Started

Follow these steps to run the project locally.

### Prerequisites

-   Python 3.10+
-   Git and Git LFS ([installation guide](https://git-lfs.github.com))
-   An NVIDIA GPU with CUDA drivers is recommended for the training pipeline, but the deployed app runs on CPU.

### 1. Clone the Repository

```bash
git clone https://github.com/YOUR-USERNAME/Emotion-Recognition-MLOps.git
cd Emotion-Recognition-MLOps