Disclaimer: I use Cursor IDE, which contains all sorts of AI models helping me write and debug my code (mainly Claude Sonnet 3.7) However as we all know, one must know what they are doing or else the code will not make sense if generated by AI alone.
This application detects smiles in human faces from uploaded videos. It uses pre-trained models to:
- Detect faces in each video frame
- Identify facial landmarks
- Calculate the probability of a smile
- Visualize the facial landmarks around the mouth
-
Install the required dependencies:
pip install -r requirements.txt
-
Download the required pre-trained models:
- The face detector model (included in OpenCV)
- The facial landmark predictor from dlib (will be downloaded automatically on first run)
-
Run the application:
python app.py
-
Open your browser and navigate to
http://localhost:5000
-
Upload a video file and the application will process it, showing the smile detection results.
The application uses:
- OpenCV's Haar Cascade classifier for face detection
- dlib's facial landmark predictor to identify 68 facial landmarks
- Custom smile detection logic based on the geometry of mouth landmarks
- Flask for the web interface
- Python 3.7+
- See requirements.txt for all dependencies