Table of Contents
In this project I wanted to test and deploy a web based emotion detection application. The application captures frames from the web cam and runs them against a pre-trained emotion detection model and then captures the output in either a sad, happy or an angry directory. During this prediction the output of all detected emotions are written to a camera-log.csv log file, that upon clicking the detection off will render in a dataframe to the webpage.
Use this README.md
to get started.
This application was built using Anaconda Python, Streamlit and a pre-trained emotion detection model.
In order to get this project up and running it is assumed that you have downloaded and installed Anaconda Python and updated all dependencies to their latest versions..
After installing Anaconda Python the command below will update the packages for you using the terminal or cmd prompt.
- Anaconda Python
conda --update-all
Create a new Python enviorment using the requirements.txt file.
- Create New Env
conda create --name <env_name> --file requirements.txt
Activate the enviornment.
- Once you created the enviornment, you need to activate it using the following command.
conda activate <env_name>
Launch the application.
- Using streamlit to launch the application locally. Navigate to the directory where the "main_app.py" is located and run the following command in the terminal.
streamlit run main_app.py
Toggles.
- You can also toggle on and off the image write functionality by editing the main_app.py file: Change switch = True. You may want to consider this if space is an issue as every Happy, Sad and Angry frame detection gets written to the drive.
switch = False
- You can also toggle on and off the log write functionality by editing the main_app.py file: Change log_switch = True. Similar to the image write functionality, you may want to turn this off as the file can get really large based on the write per detection rate.
log_switch = False
In the images below you can see still shots of the application runnning on your local machine. When deployed to Streamlit platform there are obstacles to accessing the users web cam through the browser that I and others have yet to overcome. But, It does work fine on your local machine.
Happy Detection | Angry Detection |
---|---|
![]() |
![]() |
Surprised Detection | Neutral Detection |
---|---|
![]() |
![]() |
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you want, feel free to fork this repository. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/YourFeature
) - Commit your Changes (
git commit -m 'Add some YourFeature'
) - Push to the Branch (
git push origin feature/YourFeature
) - Open a Pull Request
See the https://github.com/mstatt/Emotion_Detection/issues for a full list of proposed features (and known issues).
Project Link: [https://github.com/mstatt/Emotion_Detection]
Project Demo: [https://www.youtube.com/watch?v=AWB2cEKcME0]