Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digital Eye Strain (DES) Detection System

Python Accuracy Model Platform Lancaster University

A real-time computer vision system that detects Digital Eye Strain using facial landmark analysis, blink detection, and a deep learning classifier trained on ~16,000 images. Built as a third-year dissertation project at Lancaster University.

Achieved ~92% accuracy / F1 on the test set — exceeding the supervisor's target of ~80%. Runs cross-platform on macOS and Windows with popup notifications and session logging.


Demo

📹 Add a screen recording or GIF of the system running here


Results

Metric Value
Accuracy ~92%
F1 Score ~92%
Training images ~16,000
Inference Real-time
Platforms macOS, Windows

Features

  • EfficientNet-B0 classifier — transfer learning on a combined dataset, outperforms ResNet-18 baseline
  • Eye aspect ratio (EAR) — blink rate detection via MediaPipe Face Mesh landmarks
  • Red eye detection — HSV colour space analysis for scleral redness
  • Distance estimation — screen-to-face distance monitoring derived from facial geometry
  • Arm stretch detection — MediaPipe Pose integration for break reminders
  • Lighting analysis — ambient light level detection for environment feedback
  • Rule-based DES decision logic — multi-signal decision module with a recommendation engine
  • Cross-platform notifications — a pop-up notification system built as a subprocess (handles macOS tkinter threading constraints)
  • Session logging — CSV export of sessions and recommendations over time

Architecture

The system runs a main loop capturing webcam frames and passing them through three parallel pipelines:

  1. Deep learning classifier — EfficientNet-B0 predicts DES state from the face crop
  2. Conventional CV feature extraction — EAR blink rate, HSV red-eye score, face-to-screen distance, and ambient lighting level
  3. Pose estimator — MediaPipe Pose detects body posture and arm position for stretch reminders All outputs feed into a rule-based decision module that triggers notifications and logs the session to CSV.

Tech Stack

Category Libraries / Tools
Deep learning PyTorch, EfficientNet-B0 (transfer learning)
Computer vision OpenCV, MediaPipe Face Mesh, MediaPipe Pose
Feature engineering NumPy, HSV colour analysis
Notifications tkinter (subprocess), platform-native popups
Logging CSV (sessions + recommendations)
Language Python 3.10+

Getting Started

Prerequisites

  • Python 3.10+
  • Webcam
  • macOS 13+ or Windows 11

Installation

git clone https://github.com/YOUR_USERNAME/des-detection.git
cd des-detection
pip install -r requirements.txt

Run

python main.py

The system will open your webcam and begin monitoring in real time. Notifications will appear when DES indicators are detected.


Project Structure

des-detection/
├── test_webcam.py           # Entry point — main detection loop
├── classifier/              # EfficientNet-B0 model and training scripts
├── features/                # EAR, HSV, distance, lighting modules
├── pose/                    # MediaPipe Pose integration
├── decision/                # Rule-based DES decision module
├── notifications/           # Cross-platform popup system
├── logging/                 # Session and recommendation CSV logger
├── data/                    # Dataset preparation scripts
├── requirements.txt
└── README.md

Design Decisions

Why EfficientNet-B0 over ResNet-18? EfficientNet-B0 achieves higher accuracy with fewer parameters by simultaneously scaling width, depth, and resolution (Tan & Le, 2019). Empirically, it outperformed ResNet-18 on this dataset while remaining fast enough for real-time inference.

Why rule-based decision logic? A learned classifier for the final DES decision would require labelled multi-signal sequences, for which no suitable public dataset exists. A rule-based module is transparent, easily tunable, and interpretable — important for a health-adjacent application.

Why conventional methods for some features? EAR, HSV redness, and distance estimation are well-understood, robust, and require no training data. Using deep learning for these signals would add complexity without meaningful accuracy gains.


Acknowledgements

Developed as part of the SCC.300 Third Year Project at Lancaster University.


Author

Suleiman — LinkedIn · GitHub

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages