Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FocusGuard – AI Study Companion

FocusGuard is an AI-powered Windows desktop application designed to help students stay focused during study sessions.

It uses real-time computer vision to monitor the user's study activity through a webcam and can detect signs of drowsiness, phone usage, and absence from the study area. When distraction is detected, FocusGuard provides an alert to help the user regain focus.

The application also tracks study sessions, focused time, distracted time, and focus scores to provide useful insights into study habits.


Features

AI-Powered Drowsiness Detection

FocusGuard analyzes facial and eye activity through the webcam to detect when the user appears drowsy or keeps their eyes closed for too long.

Phone Usage Detection

A YOLO-based object detection system continuously monitors the camera feed and detects mobile phones during active study sessions.

Away Detection

FocusGuard can detect when the user leaves the study area and track that period as distracted time.

Real-Time Alerts

Audio alerts notify the user when drowsiness, phone usage, or other configured distractions are detected.

Focus Sessions

Users can create custom-duration study sessions and monitor their progress directly from the application.

Live Study Statistics

During a session, FocusGuard tracks:

  • Focused time
  • Distracted time
  • Session progress
  • Focus score

Study History

Completed sessions are stored locally so users can review previous study activity.

Analytics Dashboard

FocusGuard provides analytics to help users understand their study consistency and focus performance over time.

Customizable Settings

Users can configure monitoring behaviour and application preferences according to their requirements.

Background / System Tray Support

FocusGuard can continue operating from the Windows system tray without occupying the desktop unnecessarily.


Screenshots

FocusGuard Dashboard


How It Works

FocusGuard combines computer vision, machine learning, and desktop application technologies.

During an active focus session:

  1. The webcam captures frames in real time.
  2. MediaPipe analyzes facial and eye information.
  3. Eye behaviour is evaluated for signs of drowsiness.
  4. YOLO analyzes frames for mobile-phone presence.
  5. User presence is monitored for away detection.
  6. FocusGuard classifies periods as focused or distracted.
  7. Alerts are triggered when configured distraction conditions occur.
  8. Session statistics are recorded locally.
  9. The dashboard and analytics provide feedback about the completed study session.

Tech Stack

Technology Purpose
Python Core application development
PySide6 Desktop graphical user interface
OpenCV Webcam capture and image processing
MediaPipe Facial and eye landmark processing
YOLO11 / Ultralytics Mobile phone object detection
PyTorch Machine-learning inference
PyQtGraph Data visualization
SQLite Local study-session storage
Pygame Audio alert handling
PyInstaller Windows application packaging

Application Architecture

Webcam
   |
   v
Frame Capture
   |
   +-------------------+
   |                   |
   v                   v
Eye / Face          YOLO Phone
Detection           Detection
(MediaPipe)         (Ultralytics)
   |                   |
   +---------+---------+
             |
             v
       Monitor Worker
             |
     +-------+-------+
     |               |
     v               v
Focus Analysis     Alerts
     |
     v
Session Tracking
     |
     v
SQLite Database
     |
     v
Dashboard / Analytics

Installation

Recommended – Windows Release

The easiest way to use FocusGuard is through the packaged Windows release.

  1. Open the latest FocusGuard release.
  2. Download FocusGuard-Windows-v1.0.0.zip.
  3. Extract the ZIP file.
  4. Open the extracted FocusGuard folder.
  5. Run FocusGuard.exe.
  6. Allow camera access when required.

Do not move FocusGuard.exe outside its extracted folder because the application requires the bundled _internal files.


Download

Download the latest Windows version from:

FocusGuard v1.0.0

GitHub Releases → v1.0.0


Running From Source

Requirements

  • Windows 10/11
  • Python 3.11 recommended
  • Webcam

Clone the repository:

git clone https://github.com/Rakshith-028/focusguard.git
cd focusguard

Create a virtual environment:

python -m venv venv

Activate it on Windows:

venv\Scripts\activate

Install the required dependencies:

pip install ultralytics opencv-python mediapipe==0.10.21 pygame PySide6 pyqtgraph

Run FocusGuard:

python app_qt.py

Privacy

FocusGuard is designed as a local desktop application.

Webcam frames are processed for real-time monitoring and are not intended to be uploaded to an external server by the core application.

Study-session information is stored locally using SQLite.

This makes FocusGuard suitable for users who want computer-vision-based focus monitoring without requiring continuous cloud processing.


Project Structure

FocusGuard/
│
├── app_qt.py
├── monitor_worker.py
├── detector.py
├── phone_detector.py
├── yolo11n.pt
│
├── focusguard_release.spec
│
├── assets/
│   └── focusguard-dashboard.png
│
└── ...

The exact development structure may evolve as FocusGuard continues to improve.


Why FocusGuard?

Digital distractions are one of the biggest challenges during long study sessions.

Traditional timers can measure how long a session lasts, but they cannot determine whether the student is actually attentive.

FocusGuard explores a different approach by combining:

Study Timer + Computer Vision + Distraction Detection + Analytics

The goal is to make study sessions more measurable and help users become more aware of their focus patterns.


Current Version

FocusGuard v1.0.0

The first public Windows release includes:

  • Real-time webcam monitoring
  • Drowsiness detection
  • Phone detection
  • Away detection
  • Audio distraction alerts
  • Custom focus sessions
  • Focused and distracted time tracking
  • Focus score
  • Study history
  • Analytics
  • Settings
  • System tray support
  • Packaged Windows application

Future Improvements

Potential future improvements include:

  • Improved phone-detection accuracy
  • Additional distraction categories
  • Advanced productivity analytics
  • Weekly and monthly study reports
  • Goal and streak tracking
  • Performance improvements
  • Additional customization options
  • Optional AI-generated study insights

Disclaimer

FocusGuard is a productivity and study-assistance project.

Its computer-vision detections are probabilistic and may occasionally produce false positives or false negatives depending on lighting conditions, camera quality, viewing angle, and environment.

It should not be used as a medical drowsiness detection or safety-critical monitoring system.


Author

Rakshith

B.Tech – Artificial Intelligence & Machine Learning

GitHub: Rakshith-028


Support

If you find FocusGuard useful, consider giving the repository a ⭐.

Bug reports, suggestions, and feedback are welcome through GitHub Issues.


License

A license has not yet been specified for this project.

All rights are reserved unless a license is added to the repository.

About

AI-powered Windows study companion with real-time drowsiness, phone and distraction detection, focus tracking, alerts and analytics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages