A comparative study of machine learning approaches for driver drowsiness detection using the NTHU-DDD dataset.
Drowsy driving is one of the leading causes of road fatalities globally. AlertDrive benchmarks three model families for real-time, vision-based drowsiness detection. We implement and evaluate a classical SVM baseline using HOG features, a standalone MobileNetV2 convolutional neural network fine-tuned on individual face frames, and a hybrid CNN-LSTM architecture that combines MobileNetV2 spatial feature extraction with temporal sequence modeling via LSTM. All models are trained and evaluated on the NTHU-DDD dataset under two protocols — subject-dependent and subject-independent — to assess both in-distribution performance and generalization to unseen drivers. Results show that the CNN-LSTM achieves the best generalization with a test AUC of 0.791 in the subject-independent setting, while all models perform substantially better when test subjects overlap with training data.
AlertDrive benchmarks three model families for real-time, vision-based drowsiness detection:
| Model | Type | Temporal Modeling |
|---|---|---|
| SVM | Classical ML (HOG features) | No |
| MobileNetV2 | Pretrained CNN | No |
| CNN-LSTM | Spatiotemporal Deep Learning | Yes |
Each model is evaluated under two protocols — subject-dependent and subject-independent — to measure both raw performance and generalization to unseen drivers.
- Overview
- Report
- Project Structure
- Dataset
- Setup
- Training
- Results
- Pipeline
- Ethical Considerations
- References
- Authors
The full IEEE-format paper is available on Overleaf:
AlertDrive: A Comparative Study of ML Approaches for Driver Drowsiness Detection
AlertDrive/
├── models/
│ ├── train_svm.py # HOG + SGDClassifier pipeline
│ ├── train_mobilenet.py # MobileNetV2 two-phase fine-tuning
│ └── train_cnnlstm.py # CNN-LSTM spatiotemporal model
├── splits/
│ ├── train.csv # Training split (47,436 samples)
│ ├── val.csv # Validation split (8,006 samples)
│ └── test.csv # Test split (11,079 samples)
├── reports/
│ └── images/ # Confusion matrices, ROC curves, training plots
├── AlertDrive_IEEE_Report.tex # LaTeX source for IEEE paper
└── README.md
NTHU Driver Drowsiness Detection (NTHU-DDD)
- 66,521 preprocessed face images from 4 subjects under varying eyewear conditions
- Binary labels:
drowsy(74.1%) /not drowsy(25.9%) - 27 unique subject-eyewear-action video groups
| Split | Samples |
|---|---|
| Train | 47,436 |
| Validation | 8,006 |
| Test | 11,079 |
The dataset is not included in this repository. Request access from the NTHU-DDD authors.
Place preprocessed images under processed/drowsy/ and processed/notdrowsy/, then run the split script.
git clone https://github.com/NafisaTasnimR/AlertDrive.git
cd AlertDrive
pip install torch torchvision scikit-learn opencv-python pandas matplotlib pillowTraining was run on Google Colab with GPU acceleration. Models are saved to Google Drive at AlertDrive/models/.
python models/train_svm.py- Extracts 7,056-dim HOG features (128x128 window, 16x16 blocks, 9 bins)
SGDClassifierwithmodified_huberloss, L2 alpha=0.001- Balanced class weights, early stopping (patience=5), up to 30 epochs
python models/train_mobilenet.pyTwo-phase training:
- Phase 1 (5 epochs): frozen backbone, train classifier head only — lr=1e-3
- Phase 2 (10 epochs): full fine-tuning — lr=1e-4
python models/train_cnnlstm.py- MobileNetV2 feature extractor fed into a 2-layer LSTM (256 hidden units)
- Sequence length: 16 frames, stride: 8 frames (50% overlap)
- Batch size: 16 sequences, gradient clipping enabled
| Model | Val Acc | Val AUC | Test Acc | Test AUC |
|---|---|---|---|---|
| CNN+LSTM | 69.53% | 0.727 | 64.91% | 0.791 |
| MobileNetV2 | 77.18% | 0.848 | 57.71% | 0.608 |
| SVM | 55.28% | 0.575 | 38.34% | 0.350 |
| Model | Val Acc | Val AUC | Test Acc | Test AUC |
|---|---|---|---|---|
| MobileNetV2 | 94.20% | 0.989 | 81.42% | 0.912 |
| CNN+LSTM | 93.80% | 0.957 | 79.88% | 0.888 |
| SVM | 90.88% | 0.906 | 82.57% | 0.824 |
Key finding: CNN-LSTM has the smallest generalization gap — only 4.6% validation-to-test accuracy drop vs. 19.5% for MobileNetV2 — confirming that temporal modeling captures more generalizable drowsiness signatures.
Raw Video Frames (NTHU-DDD Dataset)
|
v
Face Detection & Cropping
|
v
Resize (224x224) + Normalize + Data Augmentation
|
+-------------------------+
| |
v v
Subject-Dependent Split Subject-Independent Split
| |
+-------------------------+
|
+---------------+---------------+
| | |
v v v
SVM MobileNetV2 CNN-LSTM
(HOG + SGD) (Frame-Based CNN) (CNN + LSTM)
| | |
+---------------+---------------+
|
v
Evaluation: Accuracy | AUC | Confusion Matrix | ROC Curve
- Privacy: All facial video should be processed on-device in any real deployment and never transmitted externally.
- Bias: The NTHU-DDD dataset covers a limited subject pool and may not generalize across age, gender, or skin tone diversity.
- Safety: This system is a supplementary safety tool, not a replacement for driver judgment. False negatives carry real safety risk and must be handled with appropriate thresholding and fail-safes.
- Tüfekci et al., Driver Drowsiness Detection Using Deep Learning Methods, Sensors 2022
- Lyu et al., LSTM-Based Drowsiness Detection, IEEE ROBIO 2018
- Shen et al., Drowsiness Detection Based on Multi-Stream CNN, IEEE ICPR 2020
- Abtahi et al., YawDD: A Yawning Detection Dataset, ACM MMSys 2014
Department of Computer Science and Engineering
Islamic University of Technology, Gazipur, Bangladesh
| Name | |
|---|---|
| Sanjana Afreen | sanjanaafreen@iut-dhaka.edu |
| Adrita Ahsan | adritaahsan@iut-dhaka.edu |
| Nishat Tasneem Oishee | nishatoishee@iut-dhaka.edu |
| Nafisa Tasnim | nafisatasnim22@iut-dhaka.edu |
| Jarin Subha Sneha | jarinsneha@iut-dhaka.edu |