This project is used to detect human emotions. There are 8 different types of emotions: surprise
, anger
, disgust
, fear
, sad
, contempt
, neutral
, happy
.
These are 2 major components:
- Face Detection: using Mediapipe library and draw bounding box.
- Emotion Recognition: using a CNN model built from scratch. Responsible for handling emotion recognition related functionalities from an image.
There are 2 ways to use the model: webcam(default), image.
Install
To install the project, follow these steps.
- Clone the project from the repository:
git clone https://github.com/vo-vuong/Emotion_Detection.git
- Navigate to the project directory:
cd Emotion_Detection
- Create a virtual environment:
python -m venv .venv
source .venv/bin/activate # For Linux/Mac
.venv\Scripts\activate # For Windows
- Install the dependencies:
pip install -r requirements.txt
Inference
Run inferences on 2 different sources webcam
(default), image file
.
python app.py --source webcam # webcam
img.jpg # image
emotion_detec/
├── constants
│ └── const.py
├── data
├── outputs # default path of model prediction
│ ├── out_images
│ └── out_videos
├── test_images
├── trained_models # the folder containing pretrain model
├── utils
│ ├── data_processing_helpers.py
│ ├── download_model.py
│ ├── file_helpers.py
│ ├── matrix_helpers.py
│ └── output_helpers.py
├── app.py # main file to run test
├── dataset_analysis.ipynb # dataset analysis file
├── dataset.py # setup dataset for train
├── detect.py
├── models.py # CNN model definition file
├── README.md
├── requirements.txt
└── train.py # training file