Computer-vision-based phone detection and voluntary focus tracking.
Personal productivity applications often rely on manual timers or website blocklists, but fail to address physical distractions—specifically picking up mobile devices during deep work sessions.
FocusGuard is a local, privacy-first computer vision utility that uses real-time object detection to monitor a user's workspace webcam feed for mobile phone usage during scheduled focus sessions. When phone interaction is detected, FocusGuard provides immediate visual cues or logs focus interruption metrics.
Notice: FocusGuard is strictly designed for voluntary, self-managed personal productivity. Video streams are processed 100% locally in memory on your device using OpenCV and lightweight neural models. No video frames, camera feeds, or facial images are ever recorded, saved to disk, or transmitted over the network.
I am the Sole Developer of FocusGuard. I conceptualized the project, integrated the YOLO object detection model pipeline with OpenCV, designed the local notification trigger system, and optimized inference performance for desktop usage.
[ Webcam Feed (Local Memory Only) ]
│
▼
[ Frame Preprocessing ] (Resize, Color Space Conversion)
│
▼
[ YOLO Neural Object Detector ] ──► (Detects 'cell phone' class boundary)
│
▼
[ Temporal Filter & Debounce Engine ]
│
▼
[ Focus Interruption Event Trigger ] (Local Sound / Desktop Alert)
- Real-Time Phone Detection: Integrates YOLO object detection trained to identify mobile devices within webcam frames.
- Temporal Debouncing: Prevents false alarms from momentary background reflections by requiring continuous detection across multiple consecutive frames before triggering an alert.
- Local Desktop Interface: Operates seamlessly in the background with minimal CPU/GPU overhead.
- Zero-Cloud Privacy: Built from the ground up without cloud dependencies or external API calls.
- Python 3.9+
- Local webcam device
-
Clone repository:
git clone https://github.com/MysticX662/FocusGuard.git cd FocusGuard -
Install Dependencies:
pip install opencv-python ultralytics numpy
-
Run FocusGuard:
python main.py
- Lighting & Angles: Extreme low-light conditions or unusual webcam angles can affect detection accuracy.
- False Positives: Objects resembling rectangular phone profiles (e.g. small notebooks or calculators) can occasionally trigger detections. Temporal debouncing minimizes but does not eliminate these cases.
- Performance: High camera resolutions (1080p+) are downsampled prior to inference to maintain ~30 FPS on standard laptop processors.