Real-time Driver Monitoring System for Drowsiness Detection and Accident Prevention
Presentation Outline
Motivation
Drowsy Driving Accident Statistics
Num of Injuries
Num of accidents
Num of Fatalities
Drowsy Driving Accident Statistics in Korea (2022)
Visualization: Data processed and visualized using Matplotlib library in Python.
Dataset Structure
Dataset
Cigarettes, phones�dataset is not used
Eye State
("Is Opened"): The primary label for classification.
Dataset Structure (YOLO Input Format)
[YOLO labeling format]�
CLASS
X
Y
WIDTH
HEIGHT
Dataset Structure �(YOLO Input Format)
Y
X
IMAGE
object being detected
width
center of X
center of Y
height
Dataset Structure
Data visualization
Class | | | |
Face | | | |
Leye | | Closed | Open |
Reye | | Closed | Open |
mouth | | | |
train
Dataset
TRAIN DATA
77952
VALIDATION
4932
TEST
4932
Model Architecture
Train result
Model Architecture
decreasing mAP50 were eliminated.
Train result
Model Architecture
Chosen Architectures: YOLOv8m and YOLOv8n
Train result
Model Architecture
YOLOv8n�(with optimizer Adam)
0.41
0.38
epoch 80
Model Architecture
epoch 26
Early stopping
0.44
0.39
YOLOv8m �(with optimizer Adam)
Model Architecture
YOLOv8n (optimizer Adam)
purpose: Face bounding box
Input shape
1 x x x
Model�(nano)
640
640
3
3
640
640
Model Architecture
YOLOv8m (optimizer Adam)
In Face detection add margin and crop
Input shape
1 x 3 x 320 x 320
Model�medium
Output class |
Face |
Eye open |
Eye closed |
Eye open |
Eye closed |
mouth |
Implementation
CUDA Not Available: Typical in-vehicle environments
Solution: Local Inference
Implementation
<environment & goal>�intel i5 13420H | Intel UHD graphics (internal graphic)
30FPS in given environment
Intel UHD graphics -> Rtx4060(laptop) 15x
Implementation
Cuda is available
YOLOv8n (face detect) [cuda]
YOLOv8m (drowsy detect) [tensorRT]
Cuda not available
YOLOv8n (face detect) [CPU]
YOLOv8m (drowsy detect) [OpenVINO]
Implementation
main.py
shared memory
Multiprocess(4)
COSTANTS
GUI
Manager
Image show
Wait show_Event
show result of model thru openCV
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Time
Calculator
Wait FPS_Event�
(timeline by frame)
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Sound manage
Nano model�(every 2sec)
openVINO
(from v8m)
Device info
Start
Exit
main.py
shared memory
Multiprocess(4)
COSTANTS
GUI
Manager
Image show
Wait show_Event
show result of model thru openCV
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Time
Calculator
Wait FPS_Event�
(timeline by frame)
Sound manage
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
Device info
Start
Exit
result
Deactivated for 2.0 second
Boundbox result
Show event
Deactivated for 2.0 second
Boundbox result
Show event
result
loop
Time
Calculator
Wait FPS_Event�
(timeline by frame)
Result Analyzed
Result Analyzed
Eyes state per frame
Deactivated for 2.0 second
Boundbox result
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Time
Calculator
Wait FPS_Event�
(timeline by frame)
Sound manage
Eyes state per frame
loop
loop
Implementation
First-Time Program Execution
1.Check if processor is running
2.Init and run multiprocessor
(exception if failed)
Set Running value true
1.Check alarm running and stop
2.Check if processor is running and collect
3. sys.exit(0)
Implementation
Multiprocess(4)
Image show
Wait show_Event
show result of model thru openCV
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Time
Calculator
Wait FPS_Event�
(timeline by frame)
Sound manage
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from YOLOv8m)
Implementation
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
Check runtime environment and load model
Implementation
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
Choose device (CPU, GPU, NPU) auto using openVINO toolkit & Load model
Implementation
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
Complie model optimized for runtime device environment
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
Define crop box�regarding nano model result
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
Store result in shared memory & call event
Implementation
Multiprocess(4)
Image show
Wait show_Event
show result of model thru openCV
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Time
Calculator
Wait FPS_Event�
(timeline by frame)
Sound manage
cv Camera read
Model inference
�call FPS_Event
Resize
Call Show_Event
Nano model�(every 2sec)
openVINO
(from v8m)
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Sound manage
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Sound manage
Implementation
eye state
detector
Check Awake
Every 0.5sec
Check Drowsy
Every 2.0 sec
Sound manage
Overlap prevention
Audio file duration => 35sec
Margin 1sec -> do not play any additional audio, until 36sec pass
Result
순서 | Model | FPS |
1 : | Yolov8m model | 3~4 |
2 : | Onnx model | 4~6 |
3 : | Onnx + with multiprocess | 8~10 |
4 : | OpenVINO exported model | 23 |
5 : | Post-processing with multiprocess | 26 |
6 : | Yolov8n(crop) + OpenVINO | 30~33 |
<environment>�intel i5 13420H | Intel UHD 620 (internal)
Result
Thank you