FocusTrack is a real-time facial behavior analysis tool that tracks attention, blink rate, yawns, and head pose using webcam video. Built on computer vision and deep learning, it’s perfect for online learning, productivity tracking, and ergonomic monitoring.
- ✅ Real-time face detection and tracking
- 👁️ Blink detection using Eye Aspect Ratio (EAR)
- 😮 Yawn detection using Mouth Aspect Ratio (MAR)
- 🧭 Head pose estimation with 3D axis overlay
- 🧑💻 Lost focus tracking (based on head orientation)
- 🚫 Face-not-present detection
- 🎞️ FPS counter to track system performance
- Uses facial landmarks to calculate eye/mouth openness
- Determines attention based on head direction
- Logs blink, yawn, distraction stats in real-time
- Python 3.10+
- OpenCV
- Dlib
- imutils
- NumPy
- Pillow
- SciPy
- torch (for Hopenet head pose estimation)
To get started with the code on this repo, you need to either clone or download this repo into your machine
https://github.com/anshhhcodes/FocusTrackBefore you begin playing with the source code, you might need to install dependencies
pip install -r requirements.txtWhen you run the script, it will automatically load all the models in models folder
python main.py- Hopenet – Head pose prediction model by Nataniel Ruiz
If you'd like to add a new feature or contribute improvements, you're absolutely welcome to do so!
Feel free to fork the repo, open a pull request, or raise an issue — contributions are encouraged!
