This project serves as a proof of concept of the use of micro-expression recognition in the field of mental health. It uses normal "macro-expressions" as well as "micro-expressions" to get the true mood of a user based on their facial expressions.
Micro-expression (ME) is an involuntary, fleeting, and subtle facial expression. It may occur in high-stake situations when people attempt to conceal or suppress their true feelings. Therefore, MEs can provide essential clues to people’s true feelings and have plenty of potential applications, such as national security, clinical diagnosis, and interrogations. In recent years, ME analysis has gained much attention in various fields due to its practical importance, especially automatic ME analysis in computer vision as MEs are difficult to process by naked eyes.
Note: This was tested in Fedora Linux 41/42 using X11 NVIDIA desktop environment. I have no idea about other Linux distros, Windows or Mac but you can try.
- Setup an anaconda environment using
conda create -n <env-name> python=3.12.9 - Activate the environment using
conda activate <env-name> - Install the requirements using
pip install -r reqiurements.txt - Download pre-trained models from the given link and put them in the
model_datafolder:
https://huggingface.co/sudo-paras-shah/micro-expression-casme2
https://github.com/tbx1b/emotion-recognizer
- Just run the
app.pycode usingstreamlit run app.py - App is now running on localhost using Streamlit UI
- Download and setup ngrok from https://dashboard.ngrok.com/get-started/setup/linux (This link is for Linux. Use the specific executable or setup code for the operating system that you are using)
- Assuming streamlit is running on port 8501, you can just run
ngrok http 8501 - Open the link provided in the terminal and you are hosting this streamlit app on the internet
- Micro-expression recognition model was trained on the CASME-II dataset for 100 epochs using this repository: MicroExpressionRecognition
- The dataset is private and requires signing of a license agreement which is available here: http://casme.psych.ac.cn/casme/
- This repository: https://github.com/tbx1b/emotion-recognizer does not belong to me and I am not claiming credit over the work done here. I quickly wanted a pre-trained facial expression recognition model so that's why I used it. You can use any facial expression recognition model that you want.