Deployed using GitHub Pages - https://swapnika29.github.io/Facial-Expression-Recognition/
This project implements a facial emotion recognition system using a pre-trained MobileNet model. The application detects facial expressions in real-time via webcam and classifies them into one of eight categories: Angry, Contempt, Disgust, Fear, Happy, Sad, Surprise, or Neutral.
-
Create a virtual environment:
conda create -n facial python=3.10 -y conda activate facial
-
Install dependencies:
pip install tensorflow opencv-python
-
Run the application:
python main.py
This script runs the real-time facial emotion recognition application. It uses OpenCV to capture video frames from the webcam and detects faces using a Haar cascade classifier. Detected faces are preprocessed and passed to the MobileNet model for emotion prediction.
This Jupyter Notebook contains the training and evaluation code for the MobileNet-based emotion recognition model. It details data preprocessing, model training, and saving the trained model as 20_epochs_mobilenet_reloaded.keras.
- The pre-trained MobileNet model is saved as
20_epochs_mobilenet_reloaded.keras. - Ensure the model file is placed in the same directory as
main.pyor update the file path in the script accordingly.
- Press
ctrl + qto quit the application during runtime. - Ensure your webcam is connected and accessible.
- Python 3.10
- TensorFlow
- OpenCV
-
No webcam feed:
- Ensure your webcam is properly connected and accessible.
-
Missing model file:
- Verify that
20_epochs_mobilenet_reloaded.kerasexists in the correct directory.
- Verify that
-
Errors related to OpenCV or TensorFlow:
- Reinstall the dependencies using the command:
pip install tensorflow opencv-python.
- Reinstall the dependencies using the command: