Skip to content

youssof20/microexpression-pain-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microexpression Pain Detector

Python Streamlit License

A webcam app that tries to detect pain from facial expressions using computer vision. I built this to learn about FACS-based pain detection and real-time video processing.

image

What it does

Uses your webcam to track facial muscle movements and estimate whether someone might be in pain. Based on the Facial Action Coding System (FACS) — looking for specific action units like brow furrowing, eye squinting, and nose wrinkling that consistently appear in pain expressions across clinical research.

Not a medical tool. Student project.


Setup

pip install -r requirements.txt
python -m streamlit run app.py --server.port 8502

Go to http://localhost:8502


How to use

  1. Click "Start Webcam"
  2. Let it detect your face
  3. Click "Set Baseline" with a neutral expression
  4. Make different expressions to see the detection respond

Project structure

src/
  detection/      face detection and feature extraction
  models/         CNN model (optional, rule-based works for testing)
  visualization/  drawing overlays on the video feed
app.py            main Streamlit app
train_model.py    train the CNN yourself if you want

Requirements

  • Python 3.8+
  • Webcam
  • Packages in requirements.txt

Limitations

Lighting affects accuracy significantly. Works differently across people. Not validated on clinical populations. The rule-based approach is good enough for exploring how the system responds — the CNN model is optional and needs its own training data to be useful.


Citation

Youssof Sallam. Microexpression Pain Detector (2025). GitHub. https://github.com/youssof20/microexpression-pain-detector

About

Real-time prototype that detects subtle facial microexpressions related to pain.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages