A real-time Eye Blink Detection System that uses facial landmark detection and eye aspect ratio (EAR) to detect user blinks via webcam. Ideal for:
- Attention monitoring
- Accessibility tools
- Human-Computer Interaction (HCI) experiments
The project features live plotting of EAR values, automatic calibration, and blink alerts with optional sound.
- 🧠 Facial landmark detection using OpenCV
- 📉 Eye Aspect Ratio (EAR) calculation with real-time visualization
- 🕵️♀️ Blink counter with state transition logic
- 🎧 Optional audio feedback on blink using
pygame - 🖥️ Runs on webcam feed in real-time
Blink-Detector/
│
├── assets/
│ └── banner.png # Project banner image
│
├── model/
│ ├── res10_300x300_ssd_iter_140000.caffemodel
│ ├── deploy.prototxt
│ └── lbfmodel.yaml # Download this file from releases
│
├── blink_detector.py # Main script
│
├── requirements.txt # Required libraries
├── .gitignore # Git ignored files
├── README.md
└── LICENSE # MIT LicenseInstall required libraries using pip:
pip install -r requirements.txtYou also need to place the following model files in the model/ folder:
res10_300x300_ssd_iter_140000.caffemodeldeploy.prototxtlbfmodel.yaml
Due to GitHub file size limits, the ibfmodel.yaml file is hosted in the Releases section of this repository.
- Go to the Releases page of this repo.
- Download the
ibfmodel.yamlfile from the latest release. - Place it inside the
models/folder before running the application.
-
Connect Webcam 📸
-
Run the program:
python blink_detector.py
-
The first few frames are used for EAR calibration
-
As EAR drops and rises, the state switches from open ➝ closed ➝ open (indicating a blink)
-
Real-time EAR graph and blink counter are displayed
-
Optional sound (
click.wav) plays when a blink is detected
Press
qanytime to quit the program.
- The Eye Aspect Ratio (EAR) is plotted in real-time
- Blinks are detected using EAR threshold crossing logic
- Visual and audible feedback help verify detection
This project is licensed under the MIT License.
See the LICENSE file for details.
Heleena Robert
GitHub
