This project is a web application for real-time facial expression recognition using different machine learning models. The application is built using Streamlit and deployed using Docker.
Real.time.demo.-.Facial.Emotion.Recognition.mp4
Application.demo.-.Facial.Emotion.Recognition.mp4
Facial-Expression-Recognition
│
├── Application
│ ├── app.py
│ ├── haarcascade_frontalface_default.xml
│ ├── Dockerfile
│ ├── requirements.txt
│ └── docker-compose.yml (optional)
│
├── Code
│ ├── CNN_from_scratch_method
│ │ ├── CNN_from_scratch.ipynb
│ │ └── model
│ │ ├── best_face_model.json
│ │ └── best_model.h5
│ │
│ ├── DeepFace_method
│ │ └── DeepFace.ipynb
│ │
│ ├── Demo_CNN_method
│ │ └── CNN_demo_real_time.py
│ │
│ ├── Demo_DeepFace_method
│ │ └── DeepFace_demo_real_time.py
│ │
│ └── SVM_method
│ ├── model
│ │ └── svm_emotion_model.joblib
│ └── SVM.ipynb
│
├── Dataset
└── Reports
- Real-time facial expression recognition using CNN, DeepFace, and SVM models.
- Visualization of detected faces with bounding boxes and predicted emotions.
- User-friendly interface built with Streamlit.
- Dockerized for easy deployment.
- Python 3.8.19
- Docker
- Docker Compose (optional)
-
Clone the repository:
git clone https://github.com/your-username/Facial-Expression-Recognition.git cd Facial-Expression-Recognition/Application
-
Ensure you have a
requirements.txt
file in theApplication
directory with the dependencies listed above.pip install -r requirements.txt
You can run the application locally using Streamlit.
streamlit run app.py
Open your web browser and navigate to http://localhost:8501
to see the application.
If you prefer to use Docker, you can pull and run the Docker image directly from Docker Hub.
-
Pulling the Docker Image
To pull the Docker image from Docker Hub, use the following command:
docker pull percevalwilhelm/emotion-detection-app
-
Running the Docker Container
Run the Docker container using:
docker run -p 8501:8501 percevalwilhelm/emotion-detection-app
You can now access the application in your web browser at
http://localhost:8501
.
-
Build the Docker Image:
docker build -t emotion-detection-app .
-
Run the Docker Container:
docker run -p 8501:8501 emotion-detection-app
-
Open your web browser and navigate to
http://localhost:8501
to access the application.
-
Create a
docker-compose.yml
file in theApplication
directory with the following content:version: '3' services: app: build: . ports: - "8501:8501"
-
Run Docker Compose:
docker-compose up
-
Open your web browser and navigate to
http://localhost:8501
to access the application.
The main application script for Streamlit. It includes functions to load models, process images, predict emotions, and display results.
Defines the Docker image configuration for the application.
Lists all the Python dependencies required for the application.
Defines the Docker Compose configuration for the application.
-
CNN Model:
Code/CNN_from_scratch_method/model/best_face_model.json
Code/CNN_from_scratch_method/model/best_model.h5
-
SVM Model:
Code/SVM_method/model/svm_emotion_model.joblib
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Special thanks to the contributors of the DeepFace and Streamlit libraries.
- Thanks to all the open-source contributors and the community for their support.