FocusGuard is a Windows desktop application that uses computer vision, real-time monitoring, and local analytics to help students understand and improve their study focus.
It can detect drowsiness, phone usage, and absence from the study area, provide real-time alerts, and track focused vs. distracted time across study sessions.
Traditional study timers can tell you how long you studied.
They cannot tell you whether you were actually focused.
FocusGuard explores a different approach by combining:
Study Sessions
+
Computer Vision
+
Distraction Detection
+
Local Analytics
During an active session, FocusGuard monitors webcam input locally and classifies periods as focused or distracted based on signals such as eye activity, phone presence, and user presence.
The application then turns that activity into measurable session statistics and historical insights.
FocusGuard analyzes facial and eye activity using MediaPipe to detect prolonged eye closure and possible drowsiness during an active study session.
A YOLO11 / Ultralytics object-detection pipeline monitors frames for mobile-phone presence.
When phone usage is detected for the configured condition, FocusGuard can classify that period as distracted and trigger an alert.
FocusGuard monitors whether the user remains present in the study area.
Periods when the user is away can be tracked separately as distracted time.
Audio alerts help bring the user's attention back when configured distraction conditions are detected.
Possible triggers include:
- drowsiness
- phone detection
- absence from the study area
Users can create custom-duration study sessions and monitor progress directly from the desktop application.
During a session FocusGuard tracks:
- focused time
- distracted time
- session progress
- focus score
Completed sessions are stored locally and can be reviewed later.
This allows users to compare previous sessions rather than treating every timer session independently.
FocusGuard turns stored session data into visual insights that help users understand:
- focus performance
- study consistency
- distracted time
- previous study activity
Monitoring behavior and application preferences can be adjusted according to the user's environment and requirements.
FocusGuard can continue operating from the Windows system tray so the application does not need to occupy the desktop during the entire study session.
During an active session:
Webcam
│
▼
Frame Capture
│
├───────────────────────┐
│ │
▼ ▼
Face / Eye Analysis Object Detection
│ │
MediaPipe YOLO11
│ │
└───────────┬───────────┘
│
▼
Monitoring Logic
│
┌────────┼────────┐
│ │ │
▼ ▼ ▼
Drowsiness Phone Away
Detection Detection Detection
│ │ │
└────────┼────────┘
│
▼
Focus Classification
│
┌──────┴──────┐
▼ ▼
Alerts Session Stats
│
▼
SQLite
│
▼
Dashboard / Analytics
Camera Frame
↓
Face Detection
↓
Facial / Eye Landmarks
↓
Eye Activity Analysis
↓
Threshold Evaluation
↓
Possible Drowsiness
↓
Alert + Distracted Time
Camera Frame
↓
YOLO11 Inference
↓
Object Detection
↓
Mobile Phone Present?
↓
Configured Condition
↓
Alert + Distracted Time
Camera Frame
↓
User Presence Check
↓
User Missing
↓
Away Condition
↓
Distracted Time
| Technology | Purpose |
|---|---|
| Python | Core application |
| PySide6 | Desktop UI |
| OpenCV | Webcam capture and image processing |
| MediaPipe | Face and eye landmark processing |
| YOLO11 / Ultralytics | Phone object detection |
| PyTorch | ML inference |
| PyQtGraph | Analytics visualization |
| SQLite | Local session storage |
| Pygame | Audio alerts |
| PyInstaller | Windows packaging |
FocusGuard separates the desktop interface from continuous monitoring logic so the UI can remain responsive while computer-vision processing runs in the background.
Conceptually:
Desktop UI
│
├── Session Controls
├── Dashboard
├── History
├── Analytics
└── Settings
│
▼
Monitor Worker
│
┌─────┴─────┐
▼ ▼
MediaPipe YOLO
│ │
└─────┬─────┘
▼
Focus Analysis
│
┌─────┴─────┐
▼ ▼
Alerts SQLite
│
▼
Session Analytics
The easiest way to run FocusGuard is through the packaged Windows release.
- Open the latest FocusGuard GitHub release.
- Download:
FocusGuard-Windows-v1.0.0.zip
- Extract the ZIP.
- Open the extracted
FocusGuarddirectory. - Run:
FocusGuard.exe
- Allow webcam access when required.
Keep
FocusGuard.exeinside the extracted application folder because the packaged application depends on bundled_internalfiles.
- Windows 10/11
- Python 3.11 recommended
- Webcam
- Git
Clone the repository:
git clone https://github.com/Rakshith-028/focusguard.git
cd focusguardCreate a virtual environment:
python -m venv venvActivate it:
venv\Scripts\activateInstall the required packages:
pip install ultralytics opencv-python mediapipe==0.10.21 pygame PySide6 pyqtgraphRun FocusGuard:
python app_qt.pyFocusGuard/
│
├── app_qt.py
├── monitor_worker.py
├── detector.py
├── phone_detector.py
├── yolo11n.pt
│
├── focusguard_release.spec
│
├── assets/
│ └── focusguard-dashboard.png
│
└── ...
The internal structure may continue to evolve as the project is developed further.
FocusGuard is designed around local processing.
Webcam frames used for monitoring are processed by the desktop application and are not intended to be uploaded to an external server by the core application.
Study-session information is stored locally using SQLite.
This allows the primary focus-monitoring workflow to operate without continuous cloud processing.
The first public Windows release includes:
- real-time webcam monitoring
- drowsiness detection
- phone detection
- away detection
- audio distraction alerts
- configurable focus sessions
- focused and distracted time tracking
- focus score
- study history
- analytics
- settings
- system tray support
- packaged Windows application
Computer-vision systems are sensitive to environmental conditions.
Detection performance may vary depending on:
- camera quality
- lighting
- viewing angle
- face visibility
- object visibility
- hardware performance
Phone and drowsiness detections are probabilistic and may occasionally produce false positives or false negatives.
FocusGuard is therefore intended as a productivity assistant, not a safety-critical monitoring system.
Possible future improvements include:
- improved phone-detection accuracy
- additional distraction categories
- richer productivity analytics
- weekly and monthly reports
- goals and study streaks
- performance optimization
- additional customization
- optional AI-generated study insights
The interesting engineering problem behind FocusGuard was not building another study timer.
It was determining whether a study session could contain information about attention quality, not just duration.
That required combining multiple systems:
- real-time webcam processing
- face and eye analysis
- object detection
- background monitoring
- desktop UI development
- local persistence
- analytics
- Windows application packaging
The project became an exploration of how computer vision could be turned into a practical desktop productivity tool rather than existing only as an isolated ML demo.
FocusGuard is a productivity and study-assistance project.
Its computer-vision detections are probabilistic and can be affected by environmental conditions.
It should not be used as a medical drowsiness detector or as a safety-critical monitoring system.
Rakshith
B.Tech — Artificial Intelligence & Machine Learning
Building AI systems, computer-vision applications, and full-stack products.
If you find FocusGuard useful, consider giving the repository a ⭐.
Bug reports, feature requests, and suggestions are welcome through GitHub Issues.
A license has not yet been specified for this project.
All rights are reserved unless a license is added.
