Real-time facial emotion recognition is a technology that uses computer vision and deep learning to analyze a person's facial expressions in real-time and determine their emotional state.
The Real-Time Facial Emotion Recognition System is a Python-based project that utilizes computer vision and deep learning techniques to perform real-time emotion detection from live video streams captured by a camera source. A CNN model is trained to recognize a range of 7 emotions, including 'Angry', 'Disgust', 'Fear', 'Happy', 'Neutral', 'Sad', and 'Surprise'.
- It all starts with training a CNN model.
- The dataset used to train and test the model is DATASET.
- You can downlaod the dataset or directly use the dataset in KAGGLE if you want to perform any changes in
real-time-facial-emotion-classification-cnn-using-keras.ipynb
file. - The trained model generated will be in .h5 format. Here the emotion detection model is
model.h5
file. - This model attained 72% training accuracy and 60% validation accuracy.
- The system employs the Haar Cascade Classifier, loaded from the
haarcascade_frontalface_default.xml
file, to detect faces in the video frames. - The code continuously captures video frames from the camera source, making real-time processing possible.
- The detected faces are passed through the emotion detection model to classify the emotion, and the corresponding emotion label is overlaid on the video frame.
- Here is the sample output. For all emotion outputs you can check out
OutputScreenshots
folder.
- Python
- TensorFlow
- Keras
- OpenCV
- Pandas
- Numpy
- Seaborn
- Matplotlib
- You can start by cloning the project repository to your local system or by downloading the zip file and extracting it in your working folder.
- Ensure you have the pre-trained emotion detection model (model.h5) and the Haar Cascade Classifier XML file (haarcascade_frontalface_default.xml) placed in the project directory. These models are essential for the system to function.
- Execute the Python script
main.py
to start the real-time facial emotion recognition system.