Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach

Abstract Driver drowsiness is a leading cause of road accidents, resulting in significant societal, economic, and emotional losses. This paper introduces a novel and robust deep learning-based framework for real-time driver drowsiness detection, leveraging state-of-the-art transformer architectures...

Full description

Saved in:
Bibliographic Details
Main Authors: Osama F. Hassan, Ahmed F. Ibrahim, Ahmed Gomaa, M. A. Makhlouf, B. Hafiz
Format: Article
Language:English
Published: Nature Portfolio 2025-05-01
Series:Scientific Reports
Online Access:https://doi.org/10.1038/s41598-025-02111-x
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1849731030954541056
author Osama F. Hassan
Ahmed F. Ibrahim
Ahmed Gomaa
M. A. Makhlouf
B. Hafiz
author_facet Osama F. Hassan
Ahmed F. Ibrahim
Ahmed Gomaa
M. A. Makhlouf
B. Hafiz
author_sort Osama F. Hassan
collection DOAJ
description Abstract Driver drowsiness is a leading cause of road accidents, resulting in significant societal, economic, and emotional losses. This paper introduces a novel and robust deep learning-based framework for real-time driver drowsiness detection, leveraging state-of-the-art transformer architectures and transfer learning models to achieve unprecedented accuracy and reliability. The proposed methodology addresses key challenges in drowsiness detection by integrating advanced data preprocessing techniques, including image normalization, augmentation, and region-of-interest selection using Haar Cascade classifiers. We employ the MRL Eye Dataset to classify eye states into “Open-Eyes” and “Close-Eyes,” evaluating a range of models, including Vision Transformer (ViT), Swin Transformer, and fine-tuned transfer learning models such as VGG19, DenseNet169, ResNet50V2, InceptionResNetV2, InceptionV3, and MobileNet. The ViT and Swin Transformer models achieved groundbreaking accuracy rates of 99.15% and 99.03%, respectively, outperforming all other models in precision, recall, and F1-score. To ensure the generalization and robustness of the proposed models, we also evaluate their performance on the NTHU-DDD and CEW datasets, which provide diverse real-world scenarios and challenging conditions. This represents a significant advancement over existing methods, demonstrating the effectiveness of transformer-based architectures in capturing complex spatial dependencies and extracting relevant features for drowsiness detection. The proposed system also incorporates a real-time drowsiness scoring mechanism, which triggers alarms when prolonged eye closure is detected, ensuring timely intervention to prevent accidents. A key novelty of this work lies in the integration of Class Activation Mapping (CAM) for enhanced model interpretability, allowing the system to focus on critical eye regions and improve decision-making transparency. The system was rigorously tested under varying lighting conditions and scenarios involving glasses, showcasing its robustness and adaptability for real-world deployment. By combining cutting-edge deep learning techniques with real-time processing capabilities, this research offers a contactless, reliable, and efficient solution for driver drowsiness detection, significantly contributing to improved road safety and accident prevention. The proposed framework sets a new benchmark in drowsiness detection, highlighting its potential for widespread adoption in advanced driver assistance systems.
format Article
id doaj-art-88f511f575614617a9c552c8ef863c85
institution DOAJ
issn 2045-2322
language English
publishDate 2025-05-01
publisher Nature Portfolio
record_format Article
series Scientific Reports
spelling doaj-art-88f511f575614617a9c552c8ef863c852025-08-20T03:08:40ZengNature PortfolioScientific Reports2045-23222025-05-0115113310.1038/s41598-025-02111-xReal-time driver drowsiness detection using transformer architectures: a novel deep learning approachOsama F. Hassan0Ahmed F. Ibrahim1Ahmed Gomaa2M. A. Makhlouf3B. Hafiz4Information Systems Department, Faculty of Computers and Informatics, Suez Canal UniversityInformation Systems Department, Faculty of Computers and Informatics, Suez Canal UniversityComputer Science and Engineering Department, Egypt Japan University of Science and Technology (E-JUST)Information Systems Department, Faculty of Computers and Informatics, Suez Canal UniversityInformation Systems Department, Faculty of Computers and Informatics, Suez Canal UniversityAbstract Driver drowsiness is a leading cause of road accidents, resulting in significant societal, economic, and emotional losses. This paper introduces a novel and robust deep learning-based framework for real-time driver drowsiness detection, leveraging state-of-the-art transformer architectures and transfer learning models to achieve unprecedented accuracy and reliability. The proposed methodology addresses key challenges in drowsiness detection by integrating advanced data preprocessing techniques, including image normalization, augmentation, and region-of-interest selection using Haar Cascade classifiers. We employ the MRL Eye Dataset to classify eye states into “Open-Eyes” and “Close-Eyes,” evaluating a range of models, including Vision Transformer (ViT), Swin Transformer, and fine-tuned transfer learning models such as VGG19, DenseNet169, ResNet50V2, InceptionResNetV2, InceptionV3, and MobileNet. The ViT and Swin Transformer models achieved groundbreaking accuracy rates of 99.15% and 99.03%, respectively, outperforming all other models in precision, recall, and F1-score. To ensure the generalization and robustness of the proposed models, we also evaluate their performance on the NTHU-DDD and CEW datasets, which provide diverse real-world scenarios and challenging conditions. This represents a significant advancement over existing methods, demonstrating the effectiveness of transformer-based architectures in capturing complex spatial dependencies and extracting relevant features for drowsiness detection. The proposed system also incorporates a real-time drowsiness scoring mechanism, which triggers alarms when prolonged eye closure is detected, ensuring timely intervention to prevent accidents. A key novelty of this work lies in the integration of Class Activation Mapping (CAM) for enhanced model interpretability, allowing the system to focus on critical eye regions and improve decision-making transparency. The system was rigorously tested under varying lighting conditions and scenarios involving glasses, showcasing its robustness and adaptability for real-world deployment. By combining cutting-edge deep learning techniques with real-time processing capabilities, this research offers a contactless, reliable, and efficient solution for driver drowsiness detection, significantly contributing to improved road safety and accident prevention. The proposed framework sets a new benchmark in drowsiness detection, highlighting its potential for widespread adoption in advanced driver assistance systems.https://doi.org/10.1038/s41598-025-02111-x
spellingShingle Osama F. Hassan
Ahmed F. Ibrahim
Ahmed Gomaa
M. A. Makhlouf
B. Hafiz
Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach
Scientific Reports
title Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach
title_full Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach
title_fullStr Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach
title_full_unstemmed Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach
title_short Real-time driver drowsiness detection using transformer architectures: a novel deep learning approach
title_sort real time driver drowsiness detection using transformer architectures a novel deep learning approach
url https://doi.org/10.1038/s41598-025-02111-x
work_keys_str_mv AT osamafhassan realtimedriverdrowsinessdetectionusingtransformerarchitecturesanoveldeeplearningapproach
AT ahmedfibrahim realtimedriverdrowsinessdetectionusingtransformerarchitecturesanoveldeeplearningapproach
AT ahmedgomaa realtimedriverdrowsinessdetectionusingtransformerarchitecturesanoveldeeplearningapproach
AT mamakhlouf realtimedriverdrowsinessdetectionusingtransformerarchitecturesanoveldeeplearningapproach
AT bhafiz realtimedriverdrowsinessdetectionusingtransformerarchitecturesanoveldeeplearningapproach