🌙 NeuroLens – Real-Time Fatigue Detection App
A lightweight, privacy-first mobile app that detects visual fatigue using your device's camera and alerts users when severe tiredness is detected.
📌 Table of Contents
Overview
Features
How It Works
Tech Stack
Project Structure
Installation
Usage
Screenshots
Future Enhancements
License
🌟 Overview
NeuroLens is a React Native (Expo) mobile application that uses the device’s front camera to monitor eye behavior and detect signs of visual fatigue.
Instead of relying on simple timers, the app calculates:
EAR (Eye Aspect Ratio)
Blink frequency
Partial eye closure (PERCLOS)
Time-based fatigue patterns
When fatigue reaches a critical threshold, the app displays a full-screen alert modal to encourage the user to rest.
The app processes everything locally, ensuring complete privacy.
✨ Features
📷 Real-time camera tracking
👁️ EAR + Blink-based fatigue detection
🧪 Calibration screen for personalized detection
🎛️ Control panel with debug tools (optional)
🎨 Clean UI with reusable components
🔒 Runs fully offline — no server required
🧠 How It Works
- Camera Feed
The app captures the front-camera stream using Expo Camera.
- Face Landmark Detection
A JavaScript-based face landmark model estimates eye geometry.
- EAR & Blink Analysis
The algorithm computes the Eye Aspect Ratio (EAR) per frame.
- Fatigue Score Calculation
The system monitors:
drop in EAR
blink duration
eye-closure percentage over time (PERCLOS)
temporal consistency
- Fatigue Alert System
Once the score passes a threshold → a SevereAlertModal is triggered.
🛠️ Tech Stack Frontend
React Native (Expo)
TypeScript (.tsx)
React Hooks
NativeWind / Tailwind (if installed)
Camera & Vision
Expo Camera
Face landmark model (TensorFlow.js / MediaPipe-style JS port)
UI
Custom modals
Reusable components
Context API / hooks
📁 Project Structure src/ ├─ components/ │ ├─ CalibrationModal.tsx │ ├─ ControlPanel.tsx │ ├─ DebugPanel.tsx │ ├─ FatigueScore.tsx │ ├─ haptic-tab.tsx │ ├─ Header.tsx │ ├─ NavLink.tsx │ ├─ SevereAlertModal.tsx │ ├─ VideoFeed.tsx ├─ hooks/ │ ├─ useCamera.ts │ ├─ useFatigue.ts ├─ lib/ │ ├─ fatigue-detection.ts │ ├─ utils.ts ├─ pages/ │ ├─ Home.tsx │ ├─ Settings.tsx App.tsx package.json tailwind.config.ts tsconfig.json
🚀 Installation 1️⃣ Clone the repo git clone https://github.com/yourname/NeuroLens.git cd NeuroLens
2️⃣ Install dependencies npm install
3️⃣ Start the Expo development server npx expo start
4️⃣ Open the app
Scan QR code with Expo Go (Android/iOS) or
Press a to launch Android emulator
Press i to launch iOS simulator (Mac only)
🧑💻 Usage 📷 Enable camera
The app will request access to your device's front camera.
🧪 Calibrate
Use the CalibrationModal to personalize EAR baseline values.
👀 Start detection
Go to the main screen → fatigue detection begins automatically.
When fatigue becomes severe, a full-screen alert blocks the UI until the user acknowledges.
🖼️ Screenshots
(Add these once your UI is ready)
[ Calibration Screen ] [ Live Video Detection ] [ Debug Panel ] [ Severe Alert Modal ]
🔮 Future Enhancements
🌐 Cloud dashboard for analytics
🚗 Driver drowsiness mode
🧬 ONNX/TFLite optimized model for faster inference
🎧 Haptic or audio alerts
📊 Fatigue history tracking