BACK

Driver Drowsiness Detection

AI IOT driven application system

📅 2024
Final Year Project
🐍 Python
🤖 AI
🔌 IOT
Hephaestus Banner

PROJECT_OVERVIEW.EXE

This project was part of the requirements to fulfill in order to acquire my B.Sc in Electronic & Computer Engineering. The main inspiration was the rising cases of road accidents in the roads and statistics shows that almost half of sampled drivers admitted to have driven in drowsiness.While human causes account to over 1/3 of all accidents,drowsiness is a huge factor in it.

About the project: The DDD is a two part system where it detects the drowsiness and later relays actions to counter the situation. Keras Models were trained on the eyes(closed and open),the mouth(yawning or not yawning) and the head position(head straight or dropped). Using these features which were assigned weights, the system was able to calculate the drowsiness of the subject over a period of time(30 seconds).
Case 1:If a driver is drowsy in the first 30s,an internal alarm system is triggered to alert the driver to stay awake
Case 2:After the first alert,if drowsiness is still detected on the subject,hazard lights are triggered in combination to the alarm.This is to warn other road user of a drowsy driver commandeering a vehicle on the road.
Case 3:If Case 2 doesnt solve the isssue then after the last 30s,the vehicle goes into a smooth deceleration while actions in case 2 still alerting road users.This removes control from the driver.

Other Actions intended to be implemented are such as alerting authorities about a rogue driver after case no 3,alerting the vehicle owner in the case of company vehicle,storage of the footage after the first 30s of drowsiness for evidence among others.

TECH_STACK.JSON

🐍
Python
cpp
C++
Keras
Keras
👐
Request
ino
Arduino
😄
Deepface
cnn
CNN
🔌
sockets

KEY_FEATURES

😄

Face detection

Uses MediaPipe and DeepFace libs to detect the face and facial features.

😵

Drowsy Detection

Uses custom trained models on facial features to detect drowsiness levels.

🎡

Driving Simulation

A car robot chassis was built with full mobility features and control to simulate driving and the deceleration in case of drowsiness

Modular Architecture

Clean separation between functionalities(Data collection,Model Training,Testing, Capturing subject's video feed,Detection real time).

🤖

Model Training

Custom trained models on the eyes,mouth and head position trained,tested and evaluated

SCREENSHOTS.JPG

loginpage
tenants
tenants

CODE_HIGHLIGHT.TOML

Here's a snippet of cnn model definition:

                    ## Lets define Drowsiness model 

                    Drowsiness_detection = tf.keras.models.Sequential([

                    layers.Conv2D(filters=16,kernel_size=3,activation='relu',input_shape=(224,224,3)),
                    layers.MaxPooling2D(pool_size=2),

                    layers.Conv2D(filters=32,kernel_size=3,activation='relu',padding='same'),
                    layers.MaxPooling2D(pool_size=2),
                    layers.BatchNormalization(),
                    layers.Dropout(0.5),

                    layers.Conv2D(filters=64,kernel_size=3,activation='relu'),
                    layers.MaxPooling2D(pool_size=2),
                    layers.BatchNormalization(),
                    layers.Dropout(0.2),

                    layers.Conv2D(filters=128,kernel_size=3,activation='relu'),
                    layers.MaxPooling2D(pool_size=2),
                    layers.BatchNormalization(),
                    layers.Dropout(0.25),

                    layers.Flatten(),

                    layers.Dense(units=128,activation='relu'),
                    layers.BatchNormalization(),
                    layers.Dropout(0.25),

                    layers.Dense(units=4,activation='softmax')
                    ])
                

PROJECT_STATISTICS.JSON

1K+
Lines of Code
1
prototype
3
Models
10+
Features

CHALLENGES_&_SOLUTIONS

EXPLORE_PROJECT