[R&D] Real-Time Eye Blink Detection with dlib & OpenCV on NVIDIA Jetson Nano — Edge AI for Maritime Watch Fatigue & Safety Monitoring
Blinkr Project · Adrit Rao (Open Source) · dlib · OpenCV · Python · Jetson Nano · Fatigue Detection · Maritime Safety
This R&D post documents the implementation of Blinkr — an open-source, AI-powered real-time eye blink detection system built on dlib and OpenCV, running on an NVIDIA Jetson Nano edge AI device. The system detects insufficient blinking and issues safety alerts, with direct applications in maritime bridge watch fatigue monitoring, port crane operator safety, and human-computer interaction.
01 · Project Background & Maritime Relevance
Fatigue is one of the leading human factors in maritime accidents. The IMO's ISM Code (International Safety Management) explicitly recognizes fatigue management as a critical element of safe vessel operations. Bridge officers on long night watches, port crane operators, and shore-based vessel traffic service (VTS) operators are all subject to dangerous levels of drowsiness that conventional monitoring cannot detect.
- Up to 16% of maritime casualties are attributed to fatigue-related human error (EMSA)
- Bridge officers on solo night watch may go unmonitored for hours
- Existing fatigue monitoring solutions are expensive, proprietary, and not edge-deployable
- Eye blink rate is one of the most reliable physiological indicators of drowsiness
- Leverage open-source Blinkr by Adrit Rao (GitHub) as the base implementation
- Integrate dlib facial landmark detection + OpenCV real-time video processing
- Deploy on NVIDIA Jetson Nano for low-cost, low-power edge AI inference
- Validate for real-time alert generation when blink frequency drops below threshold
02 · System Architecture
shape_predictor_68_face_landmarks.dat maps key facial points
03 · Development Environment & Installation
- Run all installation commands as Administrator (Windows: skip
sudo) - Read each step methodically — skipping steps causes cascading
pip installerrors - Ensure correct file paths are configured for all model files and scripts
📂 Source Code & Model File
1️⃣ [DAT File] Face Landmark Predictor
shape_predictor_68_face_landmarks.dat
Even after installing dlib, this model file may not be included. Download and place in the project working directory.
import dlib
# Set the correct path for the landmark predictor
datFile = "./shape_predictor_68_face_landmarks.dat"
# Load the face landmark predictor
dlib_facelandmark = dlib.shape_predictor(datFile)
2️⃣ OpenCV Installation
OpenCV does not ship via official pip — use these third-party packages. Run as Administrator.
pip install filterpy # Kalman filters & sensor fusion
pip install opencv-contrib-python # Extra OpenCV modules
pip install opencv-python # Core OpenCV library
3️⃣ dlib (C++ Library) Installation
- Deep learning-based facial recognition library (C++, Python binding)
- 99.38% accuracy on the Labeled Faces in the Wild (LFW) benchmark dataset
- Provides 68-point facial landmark detection essential for EAR computation
- Download: dlib.net
For Anaconda users — open Anaconda 3 Powershell Prompt, navigate to the downloaded dlib folder, and run:
python setup.py build # Compile (~10 min)
python setup.py install # Install to Python environment
Verify dlib installation:
>>> import dlib # No error = success
>>> dlib.__version__ # Check version
Open-source scripts contain predefined paths that must match your local directory structure. Always update paths before running.
# Original (may not match your setup)
xxx_train("knn_examples/train")
# Modified (relative path from project root)
xxx_train("./examples/knn_examples/train")
04 · Execution Results
- Real-time blink detection performed via OpenCV & dlib at video frame rate
- Blink count tracked dynamically and displayed on-screen
- Alert triggered when blink frequency drops below safety threshold
Blinked 1
Blinked 2
Blinked 3
Blinked 4
05 · Maritime Safety Applications & Future Work
- Port the pipeline to Jetson Nano native ARM environment (currently tested on x86 Windows)
- Integrate EAR threshold calibration per individual operator for reduced false-positives
- Add head-pose estimation to detect nodding/dozing in addition to blink rate
- Evaluate against PERCLOS (Percentage of Eye Closure) — the industry standard drowsiness metric
- Explore ONNX / TensorRT optimization for Jetson Nano inference acceleration
🔬 R&D Summary
The Blinkr project successfully demonstrates that open-source AI libraries (dlib + OpenCV) combined with edge computing (NVIDIA Jetson Nano) can deliver real-time fatigue detection at minimal cost. For the maritime industry, this represents a viable, deployable solution for bridge watch safety monitoring — directly addressing the IMO's fatigue management requirements under the ISM Code.
The next phase focuses on porting and optimizing the pipeline for true on-vessel edge deployment, with PERCLOS-based calibration and TensorRT inference acceleration on Jetson Nano.
Maritime professional exploring the intersection of AI, edge computing, and operational safety. Building open-source intelligence tools that help the maritime industry navigate the digital transformation era.
🌐 More R&D Articles ↗⚓ Join the ShipPaulJobs Community
Join →
Comments
Post a Comment