Computer Vision & Generative Media · Cloud, DevOps & LLMOps
Driver Fatigue Detection on Edge Devices
By David Gadyan · Published · Updated
On-device driver-fatigue detection for a private client: an ONNX face detector and facial-landmark model feed FFT and FFV features from a published facial-motion-entropy method into an XGBoost classifier that reads head position over a 3 to 5 second window, with rule-based yawn and eye-closure alarms. Dockerised and deployed to Raspberry Pi 4 and Jetson Nano.
The problem
A drowsy driver is a safety risk, and the warning has to come from inside the vehicle, in real time, without a connection to a server. The client wanted a system that watches the driver through a camera, decides whether they are fatigued and sounds an alarm, and it had to run on an IoT board such as a Raspberry Pi 4. That hardware constraint ruled out heavy models from the start and shaped every choice that followed.
What I built
- A research phase that settled on a published method, A Fatigue Driving Detection Algorithm Based on Facial Motion Information Entropy, as the basis of the solution.
- Face detection on the video stream with ONNX, followed by facial-landmark detection for the downstream analysis.
- Extraction of the FFT and FFV features described in the paper, and an XGBoost model trained on the current value plus the ten previous values of each, using data we labelled ourselves with a simple webcam.
- A time-aware decision: the model reads head position over roughly the last 3 to 5 seconds, so a driver who keeps their head down without moving triggers the alarm, while one who actively looks around at traffic does not.
- Separate rule-based detectors that also raise the alarm on yawning or closed eyes.
- Everything dockerised and deployed to Jetson Nano and Raspberry Pi 4 devices.
How it was delivered
Edge deployment was the hard constraint, not an afterthought. Packaging the pipeline as a Docker image meant one build could be deployed to either board, and the combination of a light ONNX detector with a gradient-boosted classifier kept inference within the limits of that hardware.
Outcome
The system detects fatigue from head motion over time rather than from a single frame, adds yawn and eye-closure rules as a safety net, and runs entirely on-device, which is what makes it usable in a vehicle. It was one of the most complex projects I have delivered end to end, from paper to edge deployment.
Related projects
Computer Vision with YOLO26/27: Three Edge-Ready Demos
Computer Vision & Generative Media · Data Science & ML · Cloud, DevOps & LLMOps
Visual Product Search with Google Vision AI
Computer Vision & Generative Media · Cloud, DevOps & LLMOps
Document OCR & Data Extraction API
Computer Vision & Generative Media · Cloud, DevOps & LLMOps