Optimization of Drowsiness Detection System Using Deep Learning on Raspberry Pi
Files
Date
Authors
Journal Title
Journal ISSN
Volume Title
Publisher
DOI
Abstract
Road traffic accidents caused by driver drowsiness remain a significant public safety concern, particularly in Indonesia where fatigue-related incidents account for a substantial proportion of road fatalities. Early and reliable detection of drowsiness in real-time is therefore critical for preventing accidents, especially in the context of long-distance driving. This research proposes and evaluates a real-time driver drowsiness detection system that integrates a Convolutional Neural Network (CNN) with MediaPipe Face Mesh and MediaPipe Hands, deployed on a Raspberry Pi 5 as an embedded platform suitable for in-vehicle use. The systems processes video frames through a sequential pipeline: CLAHE preprocessing, MediaPipe Face Mesh for facial landmark extraction, CNN classification of the face region into normal, eyes_closed, or yawn states, and conditional MediaPipe Hands invocation for yawn_hand_cover detection. Drowsiness is triggered when yawning episodes exceed five per 60-second window, activating a physical buzzer alarm via GPIO. System performance was assessed through three evaluations: (1) a MediaPipe-only landmark-based evaluation using EAR/MAR thresholds on a self-collected dataset; (2) a CNN classification evaluation on a held-out test set combining the YawDD and self-collected datasets; and (3) an integrated real-time evaluation of the deployed CNN + MediaPipe system on the Raspberry Pi 5, including functional verification and testing on five human subjects. The MediaPipe-only method achieved 93.75% accuracy but requires manual threshold calibration. The CNN-only approach achieved 97.95% accuracy with perfect yawn recall (1.000) but cannot detect yawn_hand_cover. The proposed integrated system addresses both limitations. The CNN model (161,571 parameters) was converted to TensorFlow Lite with float16 quantisation, reducing model size from 1.85 MB to 0.31 MB. The deployed system achieved 15.05 FPS on the Raspberry Pi 5, exceeding the 8 FPS target, and operates autonomously at boot without a monitor or network connection. Real-time testing on five subjects yielded 94.3% overall accuracy across seven scenarios, with core detection scenarios achieving perfect 5/5 accuracy.