An open API service indexing awesome lists of open source software.

https://github.com/noxs1d/cv-emotion-classification

This project is a deep learning-based system for detecting human emotions from facial images using TensorFlow, OpenCV, and NumPy.
https://github.com/noxs1d/cv-emotion-classification

cnn cnn-classification dockerfile keras numpy opencv tensorflow transfer-learning

Last synced: 3 months ago
JSON representation

This project is a deep learning-based system for detecting human emotions from facial images using TensorFlow, OpenCV, and NumPy.

Awesome Lists containing this project

README

          

# Emotion Detection Project (FER-2013)

This project is a deep learning-based system for detecting human emotions from facial images using TensorFlow, OpenCV, and NumPy. It is trained on the FER-2013 dataset and offers two model variants:

* A custom-built CNN (Convolutional Neural Network)
* A transfer learning model based on pre-trained VGG16

---

## 🧠 Features

* Real-time emotion detection via webcam (OpenCV)
* FER-2013 dataset support (7 emotion classes)
* Two models: scratch-trained CNN and VGG16-based transfer learning
* Pretrained models included
* Architecture overview diagram included (see assets)

---

## 🔍 Emotion Classes

* Angry
* Disgust
* Fear
* Happy
* Sad
* Surprise
* Neutral

---

## 📂 Project Structure

```
.
├── main.py # Main script for webcam-based emotion detection
├── README.md

├── models/ # Saved model files
│ ├── fer2013_model_tensorflow.h5
│ └── pretrained_model.keras

├── notebook/ # Jupyter Notebook for exploration and training
│ └── CV_project.ipynb

├── __pycache__/ # Compiled Python cache
│ └── main.cpython-312.pyc

└── .idea/ # IDE configuration (PyCharm)
```

---

## 🧱 Model Architecture Diagram

![Model Architecture](img/IMG_4942.PNG)

---

## 🚀 Getting Started

### Install Requirements

```bash
pip install -r requirements.txt
```

### Run the Application

```bash
python main.py
```

### Train Your Own Model (optional)

Open the notebook:

```
notebook/CV_project.ipynb
```

---

## 🐳 Docker Support

Dockerfile example:

```Dockerfile
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "main.py"]
```

Build & run:

```bash
docker build -t emotion-detector .
docker run --rm -it emotion-detector
```

---

## 📈 Results

| Model | Accuracy | Val Accuracy |
| ------------------------- |----------| ------------ |
| Custom CNN | \~60% | \~54% |
| VGG16 (Transfer Learning) | \~94% | \~65% |

---

## 📄 License

This project is released under the MIT License.

---

## 🙌 Credits

* FER-2013 Dataset (Kaggle)
* TensorFlow / Keras
* OpenCV
* NumPy