Skip to content

Repository files navigation

FocusGuard

Computer-vision-based phone detection and voluntary focus tracking.

License Python OpenCV


Overview & Concept

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.


Privacy-First Architecture

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.


My Role

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.


Technical Architecture & Computer Vision Pipeline

[ 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)

Key Features & Model Details

  • 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.

Getting Started & Usage

Prerequisites

  • Python 3.9+
  • Local webcam device

Installation

  1. Clone repository:

    git clone https://github.com/MysticX662/FocusGuard.git
    cd FocusGuard
  2. Install Dependencies:

    pip install opencv-python ultralytics numpy
  3. Run FocusGuard:

    python main.py

Limitations & Technical Considerations

  • 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.

About

Computer-vision-based phone detection and focus tracking.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages